15

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.

2 Answers 2

5

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
1

Make sure you know the encoding of the video you are trying to stream. With VLC you can get the codec information:

For H264:

enter image description here

The following pipeline works:

filesrc location=<video location>.mp4 ! qtdemux ! h264parse config-interval=-1 ! rtph264pay pt=96 name=pay0

And for mp4v:

enter image description here

The following pipeline works:

filesrc location=<video location>.mp4 ! qtdemux ! mpeg4videoparse ! rtpmp4vpay pt=96 name=pay0

Also the examples above work if you only care about streaming the video as is. A different pipeline is needed if you want to change the encoding or any other video property.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.