Streaming MP4 Video File on Gstreamer

Pratyush Kulwal picture Pratyush Kulwal · Apr 22, 2015 · Viewed 15.9k times · Source

I am working on gstreamer for first time and trying to Stream an MP4 Video file from a server to client using Gstreamer (RTP and UDP) . The Command Line which I am trying to use :

On Server Side:

gst-launch-1.0 -v filesrc location = file_name.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink host=192.1XX.XX.XX port=9001

On Client Side:

gst-launch-1.0 -v udpsrc port=9001 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtpstreamdepay ! decodebin ! videoconvert ! autovideosink

I am able to Stream the video successfully. But, I don't want decodebin and x264enc operations on the server side. So, I removed these operations and used this command line on the server side

gst-launch-1.0 -v filesrc location =file_name.MP4 !  rtpstreampay ! udpsink host=192.1XX.XX.XX port=9001

On which I was not able to Stream the Video.

Could anybody guide me, why do we need to have the decode and encode operations in this scenario while sending the data. Is there any way by which we can send data without using these operations.

Thanks.

Answer

Hannes R. picture Hannes R. · Oct 2, 2015

Decoding and re-encoding is not necessary. The element you are after is demultiplexer, and in this case, qtdemux.

Here a clip from it's document:

Demultiplex a QuickTime file into audio and video streams ISO base media file format support (mp4, 3gpp, qt, mj2)

It is enough to demultiplex the video container open and just read the encoded video stream directly from the container. mp4 containers usually contain H.264 encoded video, so your server-side pipeline would simplify into:

gst-launch-1.0 -v filesrc location = file_name.mp4 ! qtdemux ! video/x-h264 ! rtph264pay ! udpsink host=192.1XX.XX.XX port=9001