使用gst-launch播放原始视频

nee*_*eru 3 vlc gstreamer gst-launch

我使用filesink创建了一个原始视频文件,我可以使用以下命令使用vlc播放该文件

 vlc --demux rawvideo --rawvid-fps 24 --rawvid-width 1920 --rawvid-height 816 --rawvid-chroma I420 /home/user/Videos/out.yuv
Run Code Online (Sandbox Code Playgroud)

但是,随着

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

抛出错误

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 ...
Run Code Online (Sandbox Code Playgroud)

有任何线索如何解决此错误?

thi*_*oss 7

有2个问题.首先,帧速率应该是一个分数,所以你应该使用24/1而不是24.

第二个问题是filesrc将读取文件的块,这些块不是帧的预期大小,因此帧将不与gstreamer缓冲区对齐.您可以使用filesrc的blocksize属性来传递帧的正确字节大小(宽度*高度*每个像素的字节数),或者您可以使用videoparse元素.

 gst-launch-1.0 filesrc location=/home/user/Videos/out.yuv ! videoparse width=1920 height=816 framerate=24/1 format=2 ! autovideoconvert ! autovideosink
Run Code Online (Sandbox Code Playgroud)

检查"gst-inspect-1.0 videoparse"以了解其可用属性