Skip to content

Encoder

Nyanmisaka edited this page Mar 26, 2024 · 10 revisions

Encoder

Overview

The codecs, profiles, levels, bitrates, resolutions, FPS, AFBC, etc. supported by MPP encoders depend on the specific chip capabilities. This chapter uses RK3588 for demonstration.

 V..... h264_rkmpp           Rockchip MPP (Media Process Platform) H264 encoder (codec h264)
 V..... hevc_rkmpp           Rockchip MPP (Media Process Platform) HEVC encoder (codec hevc)
 V..... mjpeg_rkmpp          Rockchip MPP (Media Process Platform) MJPEG encoder (codec mjpeg)

Query encoders

  • Query MPP encoders
./ffmpeg -hide_banner -encoders | grep rkmpp
  • Query MPP encoder options by name
./ffmpeg -hide_banner -h encoder=h264_rkmpp
Encoder h264_rkmpp [Rockchip MPP (Media Process Platform) H264 encoder]:
    General capabilities: delay hardware
    Threading capabilities: none
    Supported hardware devices: rkmpp rkmpp drm
    Supported pixel formats: gray yuv420p yuv422p yuv444p nv12 nv21 nv16 nv24 yuyv422 yvyu422 uyvy422 rgb24 bgr24 rgba rgb0 bgra bgr0 argb 0rgb abgr 0bgr drm_prime
h264_rkmpp_encoder AVOptions:
  -rc_mode           <int>        E..V....... Set the encoding rate control mode (from 0 to 4) (default 4)
     VBR             0            E..V.......
     CBR             1            E..V.......
     CQP             2            E..V.......
     AVBR            3            E..V.......
  -qp_init           <int>        E..V....... Set the initial QP value (from -1 to 51) (default -1)
  -qp_max            <int>        E..V....... Set the max QP value for P and B frame (from -1 to 51) (default -1)
  -qp_min            <int>        E..V....... Set the min QP value for P and B frame (from -1 to 51) (default -1)
  -qp_max_i          <int>        E..V....... Set the max QP value for I frame (from -1 to 51) (default -1)
  -qp_min_i          <int>        E..V....... Set the min QP value for I frame (from -1 to 51) (default -1)
  -profile           <int>        E..V....... Set the encoding profile restriction (from -1 to 100) (default high)
     baseline        66           E..V.......
     main            77           E..V.......
     high            100          E..V.......
  -level             <int>        E..V....... Set the encoding level restriction (from -99 to 62) (default 0)
     1               10           E..V.......
     1.1             11           E..V.......
     1.2             12           E..V.......
     1.3             13           E..V.......
     2               20           E..V.......
     2.1             21           E..V.......
     2.2             22           E..V.......
     3               30           E..V.......
     3.1             31           E..V.......
     3.2             32           E..V.......
     4               40           E..V.......
     4.1             41           E..V.......
     4.2             42           E..V.......
     5               50           E..V.......
     5.1             51           E..V.......
     5.2             52           E..V.......
     6               60           E..V.......
     6.1             61           E..V.......
     6.2             62           E..V.......
  -coder             <int>        E..V....... Set the entropy coder type (from 0 to 1) (default cabac) (from 0 to 1) (default cabac)
     cavlc           0            E..V.......
     cabac           1            E..V.......
  -8x8dct            <boolean>    E..V....... Set the high profile 8x8 transform (default true)


./ffmpeg -hide_banner -h encoder=hevc_rkmpp
Encoder hevc_rkmpp [Rockchip MPP (Media Process Platform) HEVC encoder]:
    General capabilities: delay hardware
    Threading capabilities: none
    Supported hardware devices: rkmpp rkmpp drm
    Supported pixel formats: gray yuv420p yuv422p yuv444p nv12 nv21 nv16 nv24 yuyv422 yvyu422 uyvy422 rgb24 bgr24 rgba rgb0 bgra bgr0 argb 0rgb abgr 0bgr drm_prime
hevc_rkmpp_encoder AVOptions:
  -rc_mode           <int>        E..V....... Set the encoding rate control mode (from 0 to 4) (default 4)
     VBR             0            E..V.......
     CBR             1            E..V.......
     CQP             2            E..V.......
     AVBR            3            E..V.......
  -qp_init           <int>        E..V....... Set the initial QP value (from -1 to 51) (default -1)
  -qp_max            <int>        E..V....... Set the max QP value for P and B frame (from -1 to 51) (default -1)
  -qp_min            <int>        E..V....... Set the min QP value for P and B frame (from -1 to 51) (default -1)
  -qp_max_i          <int>        E..V....... Set the max QP value for I frame (from -1 to 51) (default -1)
  -qp_min_i          <int>        E..V....... Set the min QP value for I frame (from -1 to 51) (default -1)
  -profile           <int>        E..V....... Set the encoding profile restriction (from -1 to 1) (default main)
     main            1            E..V.......
  -tier              <int>        E..V....... Set the encoding profile tier restriction (from 0 to 1) (default high)
     main            0            E..V.......
     high            1            E..V.......
  -level             <int>        E..V....... Set the encoding level restriction (from -99 to 186) (default 0)
     1               30           E..V.......
     2               60           E..V.......
     2.1             63           E..V.......
     3               90           E..V.......
     3.1             93           E..V.......
     4               120          E..V.......
     4.1             123          E..V.......
     5               150          E..V.......
     5.1             153          E..V.......
     5.2             156          E..V.......
     6               180          E..V.......
     6.1             183          E..V.......
     6.2             186          E..V.......

./ffmpeg -hide_banner -h encoder=mjpeg_rkmpp
Encoder mjpeg_rkmpp [Rockchip MPP (Media Process Platform) MJPEG encoder]:
    General capabilities: delay hardware
    Threading capabilities: none
    Supported hardware devices: rkmpp rkmpp drm
    Supported pixel formats: yuv420p nv12 yuyv422 uyvy422 rgb444be bgr444be rgb555be bgr555be rgb565be bgr565be rgba rgb0 bgra bgr0 argb 0rgb abgr 0bgr x2rgb10be x2bgr10be drm_prime
mjpeg_rkmpp_encoder AVOptions:
  -qp_init           <int>        E..V....... Set the initial QP/Q_Factor value (from -1 to 99) (default -1)
  -qp_max            <int>        E..V....... Set the max QP/Q_Factor value (from -1 to 99) (default -1)
  -qp_min            <int>        E..V....... Set the min QP/Q_Factor value (from -1 to 99) (default -1)

Test encoders

  • 1080p H.264, CQP rate control
./ffmpeg -f lavfi -i testsrc2=s=1920x1080,format=nv12 -c:v hevc_rkmpp -qp_init 26 -profile:v main -level 4.1 -g:v 100 -vframes 5000 -y /tmp/tmp.mp4
  • 1080p H.264, CBR rate control
./ffmpeg -f lavfi -i testsrc2=s=1920x1080,format=nv12 -c:v h264_rkmpp -b:v 4M -profile:v high -level 4.1 -g:v 100 -vframes 5000 -y /tmp/tmp.mp4
  • 1080p H.264, VBR rate control (low latency, disable async encoding)
./ffmpeg -f lavfi -i testsrc2=s=1920x1080,format=nv12 -c:v h264_rkmpp -flags +low_delay -b:v 4M -minrate 2M -maxrate 5M -profile:v high -level 4.1 -g:v 100 -vframes 5000 -y /tmp/tmp.mp4
  • 1080p H.264, VBR rate control
./ffmpeg -f lavfi -i testsrc2=s=1920x1080,format=nv12 -c:v h264_rkmpp -b:v 4M -minrate 2M -maxrate 5M -profile:v high -level 4.1 -g:v 100 -vframes 5000 -y /tmp/tmp.mp4

  • 4K HEVC, VBR rate control
./ffmpeg -f lavfi -i testsrc2=s=3840x2160,format=nv12 -c:v hevc_rkmpp -b:v 15M -minrate 10M -maxrate 20M -profile:v main -level 5.1 -g:v 100 -vframes 5000 -y /tmp/tmp.mp4

  • 8K HEVC, VBR rate control
./ffmpeg -f lavfi -i testsrc2=s=7680x4320,format=nv12 -c:v hevc_rkmpp -b:v 30M -minrate 25M -maxrate 35M -profile:v main -level 6.1 -g:v 100 -vframes 2000 -y /tmp/tmp.mp4

  • 1080p MJPEG, CQP rate control (low latency, disable async encoding)
./ffmpeg -f lavfi -i testsrc2=s=1920x1080,format=bgra -c:v mjpeg_rkmpp -flags +low_delay -qp_init 80 -vframes 1000 -y /tmp/tmp%d.jpg
  • 1080p MJPEG, CQP rate control
./ffmpeg -f lavfi -i testsrc2=s=1920x1080,format=bgra -c:v mjpeg_rkmpp -qp_init 80 -vframes 1000 -y /tmp/tmp%d.jpg
Clone this wiki locally