H.264 GStreamer pipelines examples for non-VPU SoCs - Part 2 stream
This post shows some GStreamer pipelines examples for video streaming using H.264 on non-VPU boards.
If necessary, check the Part 1 post for more details.
For streaming configuration between two different boards and RTSP usage, please check this post.
Board to board
Video UDP stream
SERVER
gst-launch-1.0 -v filesrc location=<video_file> ! qtdemux ! queue ! rtph264pay ! udpsink host=<CLIENT_IP>
The CLIENT pipeline needs all the video udpsink caps
values to reproduce the video. So using the -v
property in the SERVER, find and copy the udpsink caps
values, as in the image below:
CLIENT
gst-launch-1.0 udpsrc caps = '<UDPSINK_CAPS>' ! rtpjitterbuffer latency=100 ! queue ! rtph264depay ! avdec_h264 ! autovideosink sync=false
The rtpjitterbuffer
plugin is used to avoid high latency problem, using the latency
property to ensure an uninterrupted data flow in the process.
Video RTSP stream
SERVER
test-uri file:///<video_file>
CLIENT
gst-launch-1.0 rtspsrc location=rtsp://<SERVER_IP>:8554/test ! queue ! rtpjitterbuffer latency=100 ! rtph264depay ! avdec_h264 ! autovideosink sync=false
Board to Linux PC
All these GStreamer pipelines were tested in the kernel BSP release 4.1.15-2.0.0 GA on an i.MX 6UltraLite EVK. The Linux host PC used was an Ubuntu 16.04 LTS with VLC media player 2.2.2 Weathermax version.
Video UDP stream
SERVER
gst-launch-1.0 -v filesrc location=<video_file> ! qtdemux ! rtph264pay ! udpsink host=<VLC_PC_IP> port=5000
CLIENT
In the Linux host PC, create a file called video.sdp with the following values and play it with the VLC media player:
v=0
m=video 5000 RTP/AVP 96
c=IN IP4 <SERVER_IP>
a=rtpmap:96 H264/90000
a=fmtp:96 sprop-parameter-sets=J01AHqkYGwe83gDUBAQG2wrXvfAQ=,KN4JyA=;
The parameter-sets value is just an example of how the udpsink caps
must be copied and changed for .sdp
files compatible string.
After entering the SERVER GStreamer pipeline, VLC allows to play the .sdp
file during 10 seconds due to its configuration.
Video + audio UDP stream
SERVER
gst-launch-1.0 filesrc location=<video_file> ! qtdemux name=d d. ! queue ! rtph264pay name=pay0 pt=96 ! udpsink host=<SERVER_IP> port=5000 sync=false d. ! queue ! rtpmp4apay name=pay1 pt=98 ! udpsink host=<SERVER_IP> port=5004
CLIENT
In the Linux host PC, create a file called video_audio.sdp with the following values and play it with the VLC media player:
v=0
m=video 5000 RTP/AVP 96
c=IN IP4 <SERVER_IP>
a=rtpmap:96 H264/90000
a=fmtp:96 sprop-parameter-sets=J01AHqkYGwe83gDUBAQG2wrXvfAQ=,KN4JyA=;
m=audio 5004 RTP/AVP 98
a=rtpmap:98 MP4A-LATM/48000
The audio quality in this last example is not perfect, but it was the best I could get with the available time. Please, fell free to enchance it and if you get any better, please share your how-to in the comments.