Multistream Encoding Decoding Simultaneously - 2023.1 English

H.264/H.265 Video Codec Unit v1.2 Solutions LogiCORE IP Product Guide (PG252)

Document ID
PG252
Release Date
2023-05-16
Version
2023.1 English

Encode and decode the input YUV into two streams by using two different encoder and two different decoder elements.

  • V4l2 → AVC encode → AVC Decode → HEVC encode → fakesink (AVC and HEVC encoding in single pipeline)
    gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=4 num-buffers=300 ! video/x-raw, width=3840, height=2160, format=NV12, framerate=30/1 ! tee name=t ! queue max-size-bytes=0 ! omxh264enc target-bitrate=25000 control-rate=constant num-slices=8 gop-mode=basic gop-length=30 prefetch-buffer=TRUE ! video/x-h264, profile=high, alignment=au ! queue ! omxh264dec ! queue max-size-bytes=0 ! omxh265enc target-bitrate=25000 control-rate=constant num-slices=8 gop-mode=basic gop-length=30 prefetch-buffer=TRUE ! video/x-h265, profile=main, alignment=au ! queue max-size-bytes=0 ! fpsdisplaysink name=fpssink text-overlay=false video-sink="fakesink sync=true" sync=true -v &
  • V4L2 → AVC encode → AVC decode → kmssink V4l2 → HEVC encode → HEVC decode → kmssink (AVC & HEVC encoding and decoding in single pipeline)
    gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=4 num-buffers=800 ! video/x-raw, width=3840, height=2160, format=NV12, framerate=30/1 ! omxh264enc target-bitrate=25000 control-rate=constant num-slices=8 gop-mode=basic gop-length=30 prefetch-buffer=TRUE ! video/x-h264, profile=high, alignment=au ! queue ! omxh264dec ! queue max-size-bytes=0 ! fpsdisplaysink name=fpssink1 text-overlay=false video-sink="kmssink bus-id="a0070000.v_mix" hold-extra-sample=TRUE plane-id=33 render-rectangle=<0,0,1920,2160>" sync=true v4l2src device=/dev/video4 io-mode=4 num-buffers=800 ! video/x-raw, width=3840, height=2160, format=NV12, framerate=30/1 ! omxh265enc target-bitrate=25000 control-rate=constant num-slices=8 gop-mode=basic gop-length=30 prefetch-buffer=TRUE ! video/x-h265, profile=main, alignment=au ! queue ! omxh265dec ! queue max-size-bytes=0 ! fpsdisplaysink name=fpssink2 text-overlay=false video-sink="kmssink bus-id="a0070000.v_mix" hold-extra-sample=TRUE plane-id=34 render-rectangle=<1920,0,1920,2160>" sync=true -v &

    In the above gstreamer pipeline, the mixer IP is used to overlay plane 33 and 34 on to the primary display plane. Plane 33 is displayed at 0,0 with a width of 1920 and height of 2160. Plane 34 is displayed at 1920,0 with a width of 1920 and height of 2160. The output resembles the following figure:

    Figure 1. Example Output

Note: H.264 and H.265 encoding and decoding are possible simultaneously if the maximum bandwidth of all the streams does not over subscribe the supported bandwidth of the Zynq UltraScale+ MPSoC VCU and system configuration.