Streaming Out Using RTP Unicast Example

Multimedia User Guide (UG1449)

Document ID
UG1449
Release Date
2023-10-19
Revision
1.7 English
  • For only a video stream out:

    Use the following pipeline to send a video stream of input source, from one device to another device on the same network.

    gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! \
    video/x-raw, format=NV12, width=3840, height=2160, framerate=60/1 ! \
    omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=60000 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

    This example shows that video streamed out from one device (server) to another device (client) on the same network. Encoded video format is H265 and color format is NV12.Video stream resolution is 4kp with 60fps, and bitrate is 60 Mbps. Server sends the video stream to the client host device with IP Address 192.168.25.89 on port 5004.

    Note: Replace host IP address as per IP configuration of the client device.
  • For both video and audio stream out:

    Use the following pipeline to send both video and audio stream of input source, from one device to another device on the same network.

    gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! \
    video/x-raw, format=NV12, width=3840, height=2160, framerate=60/1 \
    ! omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \
    target-bitrate=60000 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 ! mux. alsasrc device=hw:2,1 \
    provide-clock=false ! audio/x-raw, format=S24_32LE, rate=48000, \
    channels=2 ! queue ! audioconvert ! audioresample ! opusenc \
    ! opusparse ! mpegtsmux name=mux ! rtpmp2tpay \
    ! udpsink host=192.168.25.89 port=5004

    This example shows that video and audio can be streamed out using a single gstreamer pipeline. Encoded audio is in Opus. Audio and video is streamed out simultaneously. For video stream-out, the pipeline remains the same as in the previous example.