我已经使用filesink创建了一个原始视频文件,我可以使用以下命令使用vlc播放该文件
vlc --demux rawvideo --rawvid-fps 24 --rawvid-width 1920 --rawvid-height 816 --rawvid-chroma I420 /home/user/Videos/out.yuv
但是,随着
gst-launch-1.0 filesrc location=/home/user/Videos/out.yuv ! video/x-raw,format=I420,height=816,width=1920,framerate=24 ! autovideoconvert ! autovideosink
抛出错误
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 ...
知道如何解决此错误吗?
最佳答案
有 2 个问题。首先,帧速率预计为分数,因此您应该使用 24/1 而不是 24。
第二个问题是 filesrc 将读取不是预期帧大小的文件 block ,因此帧不会与 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
检查“gst-inspect-1.0 videoparse”以了解其可用属性
关于gstreamer - 使用 gst-launch 播放原始视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27419113/