Multi-Stream

Multimedia User Guide (UG1449)

Document ID
UG1449
Release Date
2022-04-21
Revision
1.4 English

The following pipelines show that multiple streams can be played simultaneously using Gstreamer-1.0.

  • Two simultaneous instances of 4k resolution:
    gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! \
    video/x-raw, format=NV12, width=3840, height=2160,framerate=30/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=30000 num-slices=8 control-rate=constant \
    prefetch-buffer=true low-bandwidth=false \
    filler-data=true cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \
    video/x-h265, profile=main, alignment=au ! queue ! \
    mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \
    udpsink host=192.168.25.89 port=5004
    gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! \
    video/x-raw, format=NV12, width=3840, height=2160, framerate=30/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=30000 num-slices=8 control-rate=constant \
    prefetch-buffer=true low-bandwidth=false filler-data=true \
    cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \
    video/x-h265, profile=main, alignment=au ! queue ! \
    mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \
    udpsink host=192.168.25.89 port=5008

    In this example, two instances of 4k resolution are streamed out. Maximum bit rate is 30 Mb/s and 30 fps. Encoded video format is H265.

    Note:
    1. Input source devices can be as per your choice and availability. In the preceding example, two input devices are used, video0 and video1.
    2. To run multiple instances, it is recommended to execute pipelines in the background by adding & at the end of the pipeline.
    3. To stream out both video streams, use two different ports for the same host device (that is, port=5004, and port=5008) to avoid incorrect data stream.
  • Four simultaneous instances of 1080p60 resolution:
    gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! \
    video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=15000 num-slices=8 control-rate=constant \
    prefetch-buffer=true low-bandwidth=false filler-data=true \
    cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \
    video/x-h265, profile=main, alignment=au ! queue ! \
    mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \
    udpsink host=192.168.25.89 port=5004
    gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! \
    video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=15000 num-slices=8 control-rate=constant \
    prefetch-buffer=true low-bandwidth=false filler-data=true \
    cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \
    video/x-h265, profile=main, alignment=au ! queue ! \
    mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \
    udpsink host=192.168.25.89 port=5008
    gst-launch-1.0 v4l2src device=/dev/video2io-mode=4 ! \
    video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=15000 num-slices=8 control-rate=constant \
    prefetch-buffer=true low-bandwidth=false filler-data=true \
    cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \
    video/x-h265, profile=main, alignment=au ! queue ! \
    mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \
    udpsink host=192.168.25.89 port=5012
    gst-launch-1.0 v4l2src device=/dev/video3io-mode=4 ! \
    video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=15000 num-slices=8 control-rate=constant \
    prefetch-buffer=truelow-bandwidth=false filler-data=true \
    cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \
    video/x-h265, profile=main, alignment=au ! queue ! \
    mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \
    udpsink host=192.168.25.89 port=5016

    In this example, you can stream out four instances of 1080p resolution. Maximum bit rate can be 15 Mb/s and 60 fps. Encoded video format is H265.

    Note:
    1. Input source devices can be as per your choice and availability. In the preceding example, four input devices are used, video0, video1, video2, and video3.
    2. To run multiple instances, it is recommended to execute pipelines in background by adding & at the end of pipeline.
    3. To stream out all four video streams, four different ports are used for same host device (that is, 5004, 5008, 5012, and 5016) to avoid incorrect data stream.