.. include:: /keyword.rst .. _video-g720-evk: =============== |G520-G720-EVK| =============== .. contents:: Sections :local: :depth: 1 Video CODEC Device Tree Overlay ------------------------------- Because there is no MT8391 video codec driver in Linux mainline, we have to migrate the MediaTek proprietary video codec driver to `IoT Yocto` and make it as a device tree overlay for the integration. (For how to download an image to |G520-G720-EVK-REF-BOARD|, please refer to :doc:`Genio tools`.) Command to list the device tree overlay that supported on |G520-G720-EVK-REF-BOARD| image: .. prompt:: $ genio-flash --list-dtbo List of available DTBO: ( * items are automatically loaded ) * apusys.dtbo camera-ag190h-max96724-csi0-std.dtbo camera-ag190h-max96724-csi1-std.dtbo camera-ag190h-max96724-dual-std.dtbo camera-imx258-csi0-ov5640-csi1-std.dtbo camera-imx258-csi0-std.dtbo camera-imx258-csi1-std.dtbo camera-imx258-dual-std.dtbo camera-it6625-csi1-std.dtbo camera-ov5640-csi0-std.dtbo camera-ov5640-csi1-std.dtbo camera-ov5640-dual-std.dtbo display-dp.dtbo * display-dsi.dtbo display-edp-4k.dtbo display-edp-fhd.dtbo * emmc.dtbo spi-test.dtbo ufs.dtbo * video.dtbo Command to flash image with ``video.dtbo`` (to install `vcodec` and `vcu` drivers): .. prompt:: $ genio-flash --load-dtbo video.dtbo AIoT Tools: v1.7.0 Yocto Image: name: Rity BSP Image (rity-bsp-image) distro: Rity Demo Layer 25.1-release (rity-demo) codename: scarthgap machine: genio-720-evk overlays: ['video.dtbo'] Looking for MediaTek SoC matching USB device 0e8d:0003 ... After boot to home, check if the V4L2 video devices mount successfully: .. prompt:: bash # auto #root@genio-720-evk:~# ls -l /sys/class/video4linux/ total 0 lrwxrwxrwx 1 root root 0 May 29 18:48 video0 -> ../../devices/platform/soc/17030000.jpeg-encoder/video4linux/video0 lrwxrwxrwx 1 root root 0 May 29 18:48 video1 -> ../../devices/platform/soc/17040000.jpeg-decoder/video4linux/video1 lrwxrwxrwx 1 root root 0 May 30 11:49 video2 -> ../../devices/platform/soc/1f003000.dma-controller/video4linux/video2 lrwxrwxrwx 1 root root 0 May 30 11:49 video3 -> ../../devices/platform/soc/16000000.vdec/video4linux/video3 lrwxrwxrwx 1 root root 0 May 30 11:49 video4 -> ../../devices/platform/soc/17020000.venc/video4linux/video4 Supported Formats of MDP ------------------------ List `Video Output` formats: .. prompt:: bash # auto # v4l2-ctl -d2 --list-formats-out ioctl: VIDIOC_ENUM_FMT Type: Video Output Multiplanar [0]: 'GREY' (8-bit Greyscale) [1]: 'RGBR' (16-bit RGB 5-6-5 BE) [2]: 'RGBP' (16-bit RGB 5-6-5) [3]: 'RGB3' (24-bit RGB 8-8-8) [4]: 'BGR3' (24-bit BGR 8-8-8) [5]: 'AB24' (32-bit RGBA 8-8-8-8) [6]: 'AR24' (32-bit BGRA 8-8-8-8) [7]: 'BA24' (32-bit ARGB 8-8-8-8) [8]: 'UYVY' (UYVY 4:2:2) [9]: 'VYUY' (VYUY 4:2:2) [10]: 'YUYV' (YUYV 4:2:2) [11]: 'YVYU' (YVYU 4:2:2) [12]: 'YU12' (Planar YUV 4:2:0) [13]: 'YV12' (Planar YVU 4:2:0) [14]: 'NV12' (Y/UV 4:2:0) [15]: 'NV21' (Y/VU 4:2:0) [16]: 'NV16' (Y/UV 4:2:2) [17]: 'NV61' (Y/VU 4:2:2) [18]: 'NM12' (Y/UV 4:2:0 (N-C)) [19]: 'MM21' (Mediatek 8-bit Block Format) [20]: 'NM21' (Y/VU 4:2:0 (N-C)) [21]: 'NM16' (Y/UV 4:2:2 (N-C)) [22]: 'NM61' (Y/VU 4:2:2 (N-C)) [23]: 'YM12' (Planar YUV 4:2:0 (N-C)) [24]: 'YM21' (Planar YVU 4:2:0 (N-C)) [25]: 'YM16' (Planar YUV 4:2:2 (N-C)) [26]: 'YM61' (Planar YVU 4:2:2 (N-C)) List `Video Capture` formats: .. prompt:: bash # auto # v4l2-ctl -d2 --list-formats ioctl: VIDIOC_ENUM_FMT Type: Video Capture Multiplanar [0]: 'GREY' (8-bit Greyscale) [1]: 'RGBR' (16-bit RGB 5-6-5 BE) [2]: 'RGBP' (16-bit RGB 5-6-5) [3]: 'RGB3' (24-bit RGB 8-8-8) [4]: 'BGR3' (24-bit BGR 8-8-8) [5]: 'AB24' (32-bit RGBA 8-8-8-8) [6]: 'AR24' (32-bit BGRA 8-8-8-8) [7]: 'BA24' (32-bit ARGB 8-8-8-8) [8]: 'UYVY' (UYVY 4:2:2) [9]: 'VYUY' (VYUY 4:2:2) [10]: 'YUYV' (YUYV 4:2:2) [11]: 'YVYU' (YVYU 4:2:2) [12]: 'YU12' (Planar YUV 4:2:0) [13]: 'YV12' (Planar YVU 4:2:0) [14]: 'NV12' (Y/UV 4:2:0) [15]: 'NV21' (Y/VU 4:2:0) [16]: 'NV16' (Y/UV 4:2:2) [17]: 'NV61' (Y/VU 4:2:2) [18]: 'NM12' (Y/UV 4:2:0 (N-C)) [19]: 'NM21' (Y/VU 4:2:0 (N-C)) [20]: 'NM16' (Y/UV 4:2:2 (N-C)) [21]: 'NM61' (Y/VU 4:2:2 (N-C)) [22]: 'YM12' (Planar YUV 4:2:0 (N-C)) [23]: 'YM21' (Planar YVU 4:2:0 (N-C)) [24]: 'YM16' (Planar YUV 4:2:2 (N-C)) [25]: 'YM61' (Planar YVU 4:2:2 (N-C)) Video Decoder Codec Types ------------------------- .. csv-table:: Codec types of `mtk-vcodec-dec` on |G520-G720-EVK| :class: longtable :file: /_asset/tables/video_g520_g720_vdec_spec.csv :width: 70% :header-rows: 1 Video Encoder Codec Types ------------------------- .. csv-table:: Codec types of `mtk-vcodec-enc` on |G520-G720-EVK| :class: longtable :file: /_asset/tables/video_g520_g720_venc_spec.csv :width: 70% :header-rows: 1 Video Codec Capabilities ------------------------ On Genio-520/Genio-720, the maximum instance number of VDEC is 16, and the maximum instance of VENC is 10. The maximum resolution/framerate of multiple instances might be calculated by SPEC listed in the following section. For example, the maximum spec of MPEG4 video decoding is FHD(1920x1080) 60fps. We might support two 1920x1080-30fps videos or eight 720x480-30fps videos. It is okay to run VDEC and VENC at the same time without any conflict. .. csv-table:: H264 decoder (w/ MDP) concurrent test result on |G520-G720-EVK| :class: longtable :file: /_asset/tables/video_g520_g720_vdec_concurrent.csv :width: 70% :header-rows: 1 .. csv-table:: H264 encoder concurrent test result on |G520-G720-EVK| :class: longtable :file: /_asset/tables/video_g520_g720_venc_concurrent.csv :width: 70% :header-rows: 1 .. note:: The more instances, the more SW overhead(CPU / bandwidth / IO... etc) was generated. Leave some margins for the overheads. Video Encoder Extra-Controls ============================ As a V4L2 video encoder, ``mtk-vcodec-enc`` also provides extra-controls to set encoder capabilities. .. prompt:: bash # auto Codec Controls video_b_frames 0x009909ca (int) : min=0 max=3 step=1 default=0 value=0 flags=update video_gop_size 0x009909cb (int) : min=0 max=65535 step=1 default=0 value=0 video_bitrate_mode 0x009909ce (menu) : min=0 max=2 default=0 value=0 (Variable Bitrate) flags=update 0: Variable Bitrate 1: Constant Bitrate 2: Constant Quality video_bitrate 0x009909cf (int) : min=0 max=400000000 step=1 default=20000000 value=20000000 frame_level_rate_control_enable 0x009909d7 (bool) : default=1 value=1 sequence_header_mode 0x009909d8 (menu) : min=0 max=1 default=1 value=1 (Joined With 1st Frame) 0: Separate Buffer 1: Joined With 1st Frame maximum_bytes_in_a_slice 0x009909db (int) : min=0 max=524287 step=1 default=0 value=0 video_encode_nonrefp 0x009909dc (int) : min=0 max=65535 step=1 default=0 value=0 flags=write-only slice_partitioning_method 0x009909dd (menu) : min=0 max=2 default=0 value=0 (Single) 0: Single 1: Max Macroblocks 2: Max Bytes force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write h264_i_frame_period 0x00990a66 (int) : min=0 max=65535 step=1 default=0 value=0 h264_level 0x00990a67 (menu) : min=0 max=19 default=0 value=0 (1) 0: 1 1: 1b 2: 1.1 3: 1.2 4: 1.3 5: 2 6: 2.1 7: 2.2 8: 3 9: 3.1 10: 3.2 11: 4 12: 4.1 13: 4.2 14: 5 15: 5.1 16: 5.2 17: 6.0 18: 6.1 19: 6.2 h264_profile 0x00990a6b (menu) : min=0 max=5 default=0 value=0 (Baseline) 0: Baseline 1: Constrained Baseline 2: Main 3: Extended 4: High 5: High 10 video_encode_vui_sar_descriptio 0x00990a6e (u32) : min=0 max=4294967295 step=1 default=0 dims=[4] flags=write-only, has-payload hevc_profile 0x00990b67 (menu) : min=0 max=0 default=0 value=0 (Main) 0: Main hevc_level 0x00990b68 (menu) : min=0 max=12 default=0 value=0 (1) 0: 1 1: 2 2: 2.1 3: 3 4: 3.1 5: 4 6: 4.1 7: 5 8: 5.1 9: 5.2 10: 6 11: 6.1 12: 6.2 hevc_tier 0x00990b6a (menu) : min=0 max=1 default=0 value=0 (Main) 0: Main 1: High video_encode_slice_loss_indicat 0x00990b84 (int) : min=0 max=1 step=1 default=0 value=0 flags=write-only video_encode_color_description 0x00992007 (u32) : min=0 max=4294967295 step=1 default=0 dims=[18] flags=write-only, has-payload video_encode_scenario 0x00992014 (int) : min=0 max=32 step=1 default=0 value=0 flags=write-only video_encode_operation_rate 0x00992018 (int) : min=0 max=2048 step=1 default=0 value=0 flags=write-only i_frame_qp_value 0x0099201f (int) : min=0 max=51 step=1 default=51 value=0 flags=write-only p_frame_qp_value 0x00992020 (int) : min=0 max=51 step=1 default=51 value=0 flags=write-only b_frame_qp_value 0x00992021 (int) : min=0 max=51 step=1 default=51 value=0 flags=write-only video_encode_tsvc 0x00992022 (u32) : min=0 max=15 step=1 default=0 dims=[2] flags=write-only, has-payload video_encode_max_qp 0x00992024 (int) : min=-1 max=51 step=1 default=-1 value=0 flags=write-only video_encode_min_qp 0x00992025 (int) : min=-1 max=51 step=1 default=-1 value=0 flags=write-only video_encode_ip_qp_delta 0x00992026 (int) : min=-1 max=51 step=1 default=-1 value=0 flags=write-only video_encode_qp_control_mode 0x00992027 (int) : min=0 max=8 step=1 default=0 value=0 flags=write-only video_encode_frame_level_qp 0x00992028 (int) : min=-1 max=51 step=1 default=-1 value=0 flags=write-only video_encode_enable_highquality 0x0099202d (int) : min=0 max=1 step=1 default=0 value=0 flags=write-only video_log 0x0099202e (str) : min=0 max=255 step=1 value= flags=write-only, has-payload video_encode_qp_control_mode 0x00992038 (int) : min=0 max=3 step=1 default=0 value=0 flags=write-only video_encode_set_slice_count 0x00992042 (int) : min=1 max=8 step=1 default=1 value=0 flags=write-only video_encode_qpvbr 0x00992043 (int) : min=-1 max=255 step=1 default=-1 dims=[3] flags=write-only, has-payload video_encode_chroma_qp 0x00992044 (int) : min=-12 max=99 step=1 default=99 dims=[2] flags=write-only, has-payload video_encode_mb_rc_tracking_spe 0x00992045 (int) : min=-1 max=63 step=1 default=-1 value=0 flags=write-only video_encode_frame_qp_limiter 0x00992046 (int) : min=-1 max=30 step=1 default=-1 dims=[3] flags=write-only, has-payload video_encode_visual_quality 0x00992047 (int) : min=-1 max=63 step=1 default=-1 dims=[2] flags=write-only, has-payload video_encode_initial_qp 0x00992048 (int) : min=-1 max=51 step=1 default=-1 dims=[4] flags=write-only, has-payload video_encode_frame_qp_range 0x0099204a (int) : min=-1 max=51 step=1 default=-1 dims=[3] flags=write-only, has-payload video_encode_inputdyanmicctrl 0x0099204b (int) : min=0 max=1 step=1 default=0 value=0 flags=write-only