Difference between revisions of "Mainline Hardware Encoding"

From PINE64
Jump to navigation Jump to search
m (→‎SoC Support: getting fancy with tables)
(→‎SoC Support: Add rk3328 to table)
Line 7: Line 7:
{| class="wikitable plainrowheaders" border="1"
{| class="wikitable plainrowheaders" border="1"
! scope="col" {{Diagonal split header|Codec|SoC}}
! scope="col" {{Diagonal split header|Codec|SoC}}
! scope="col" | RK3328
! scope="col" | RK3399
! scope="col" | RK3399
! scope="col" | RK3566
! scope="col" | RK3566
Line 12: Line 13:
|-
|-
! scope="row" | JPEG
! scope="row" | JPEG
| style="text-align:center;"| N/A
| style="background:PaleGreen; text-align:center;"| Yes
| style="background:PaleGreen; text-align:center;"| Yes
| style="background:LightYellow; text-align:center;"| In review
| style="background:LightYellow; text-align:center;"| In review
Line 17: Line 19:
|-
|-
! scope="row" | H.264/AVC
! scope="row" | H.264/AVC
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
Line 22: Line 25:
|-
|-
! scope="row" | H.265/HEVC
! scope="row" | H.265/HEVC
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No
| style="background:#F99; text-align:center;"| No

Revision as of 16:18, 28 April 2022

Mainline Hardware Encoding of video can be achieved through the V4L2 user-space API, for which currently only GStreamer implements the required code.

SoC Support

The following table shows the current supported codecs for encoding for each SoC. Support for decoding is separate.

SoC
Codec
RK3328 RK3399 RK3566 RK3588
JPEG N/A Yes In review No
H.264/AVC No No No No
H.265/HEVC No No No No

Encoding With GStreamer

With GStreamer, in general, any V4L2 control can be set using the extra-controls=foo,name=value syntax after the encode pipeline stage identifier, where foo is any name you wish which GStreamer will promptly ignore, name is the name of the V4L2 control as shown by v4l2-ctl --list-ctrls (make sure to pick the right device with -d), and value is whatever value you want to set it to.

JPEG Encoding

This example converts an input MP4 file to an output MJPEG-inside-MKV file at JPEG quality 95, without any audio.

   gst-launch-1.0 filesrc location=input.mp4 ! qtdemux name=demux demux.video_0 ! decodebin ! videoconvert ! v4l2jpegenc extra-controls=s,compression_quality=95 ! matroskamux ! filesink location=output.mkv