ffmpegcommand-linegstreamerffplay

The fdsink element in GStreamer cannot be used to output the correct byte-stream to the pipeline


Because I need to output the RTSP stream pulled from the GStreamer command line to my Python program, I use the fdsink element to output the byte-stream from the pipeline. The video can be displayed correctly by using the xvimagesink element. The command line is as follows.

gst-launch-1.0 rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 ! queue2 ! rtph264depay ! capsfilter caps="video/x-h264, width=240, height=160" ! avdec_h264 ! videoconvert ! xvimagesink

Correct video: enter image description here

Then I use fdsink instead of the xvimagesink element to output the byte stream from the pipeline and play it with ffplay. It can't display correct video. The command line is as follows.

gst-launch-1.0 rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 ! queue2 ! rtph264depay ! capsfilter caps="video/x-h264, width=240, height=160" ! avdec_h264 ! videoconvert ! fdsink | ffplay -f rawvideo -pixel_format rgb24 -video_size 240*160 -i -

Wrong video:enter image description here

So is fdsink element wrong or other elements wrong? Thank you for taking the time to help me solve the problem


Solution

  • There are two issues:


    The following command plays well in my machine:

    gst-launch-1.0 --quiet rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 ! queue2 ! rtph264depay ! capsfilter caps="video/x-h264, width=240, height=160" ! avdec_h264 ! videoconvert ! capsfilter caps="video/x-raw, format=BGR" ! fdsink | ffplay -f rawvideo -pixel_format rgb24 -video_size 240x160 -i -


    It also works without capsfilter caps="video/x-h264, width=240, height=160":

    gst-launch-1.0 --quiet rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 ! queue2 ! rtph264depay ! avdec_h264 ! videoconvert ! capsfilter caps="video/x-raw, format=BGR" ! fdsink | ffplay -f rawvideo -pixel_format rgb24 -video_size 240x160 -i -