Home

Awesome

rkmppenc

by rigaya

Build Linux Packages

日本語版はこちら>>

This software is meant to investigate performance and image quality of hw encoder on rockchip SoCs, which is used on SBCs such as Orange Pi, Nano Pi, and Radxa ROCK.

Example of 1080p transcoding using hw encoder and decoder in ROCK 5B (RK3588 SoC). rkmppenc_encode_sample

Downloads & update history

github releases

Install

Install instructions for Linux.

Build

Build instructions for Linux

System Requirements

Linux

Debian/Ubuntu It may be possible to run on other distributions (not tested).

Usage and options of rkmppenc

Option list and details of rkmppenc

Precautions for using rkmppenc

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.

Main usable functions

rkmppenc

Using Radxa ROCK 5B HDMI In

Radxa ROCK 5B (RK3588) HDMI In uses v4l2 multi-planar API, and does not respond to some v4l2 API queries. Therefore, it cannot be captured by ffmpeg 6.0.

rkmppenc uses ffmpeg with modification to support v4l2 multi-planar API, and workarounds to avoid errors. For example, HDMI In can be captured by following command line.

# video settings
V4L2_DV_TIMINGS_IDX=19
v4l2-ctl --set-dv-bt-timings index=${V4L2_DV_TIMINGS_IDX}
# index from v4l2-ctl --list-dv-timings
# Rock 5B (RK3588) list
# 10 1920x1080 30fps
# 14 1920x1080 60fps
# 17 3840x2160 30fps
# 19 3840x2160 60fps

# auto select hdmiin auto
ALSA_DEVICE_ID=`arecord -l | grep rockchiphdmiin | sed -e 's/^card \([0-9]\+\).*/\1/g'`
echo ALSA_DEVICE_ID=${ALSA_DEVICE_ID}

# add --input-analyze and --input-probesize to minimize startup latency
rkmppenc --input-format v4l2 -i /dev/video0 \
  --input-analyze 0.2 --input-probesize 10000 \
  --input-option channel:0 --input-option ignore_input_error:1 --input-option ts:abs \
  --audio-source "hw:${ALSA_DEVICE_ID}:format=alsa/codec=aac;enc_prm=aac_coder=twoloop;bitrate=192" \
  -o out.ts

Video

To change input settings v4l2-ctl is required.

sudo apt install v4l-utils

Chaging input resolution

We can check the supported input resolution and fps by v4l2-ctl --list-dv-timings. The run v4l2-ctl --set-dv-bt-timings index=<n> with the index.

Audio

Device ID can be checked using arecord -l.

To use alsa hw, user needs to be added to "audio" group.

sudo gpasswd -a `id -u -n` audio

rkmppenc source code

About source code

Character code: UTF-8-BOM
Line feed: CRLF
Indent: blank x4