playing a raw video using gst-launch

neeru picture neeru · Dec 11, 2014 · Viewed 14.8k times · Source

I've created a raw video file using filesink, I am able to play the file with vlc with the following command

 vlc --demux rawvideo --rawvid-fps 24 --rawvid-width 1920 --rawvid-height 816 --rawvid-chroma I420 /home/user/Videos/out.yuv

But, with

 gst-launch-1.0 filesrc location=/home/user/Videos/out.yuv ! video/x-raw,format=I420,height=816,width=1920,framerate=24 ! autovideoconvert ! autovideosink

throws error

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format
Additional debug info:
gstcapsfilter.c(348): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: EMPTY
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Any clue how to resolve this error?

Answer

thiagoss picture thiagoss · Dec 11, 2014

There are 2 issues. First the framerate is expected to be a fraction, so you should use 24/1 instead of 24.

The second problem is that the filesrc will read chunks of the file that are not the expected size of a frame, so frames won't be aligned with gstreamer buffers. You can either use filesrc's blocksize property to pass the correct bytes size of a frame (width * height * bytes per pixel) or you can just use videoparse element.

 gst-launch-1.0 filesrc location=/home/user/Videos/out.yuv ! videoparse width=1920 height=816 framerate=24/1 format=2 ! autovideoconvert ! autovideosink

Check "gst-inspect-1.0 videoparse" to learn about its available properties