为什么这个gstreamer管道失速?

tim*_*day 7 audio video command-line video-processing gstreamer

这有效:

gst-launch-0.10 \
videotestsrc ! ffmpegcolorspace ! 'video/x-raw-yuv' ! mux. \
audiotestsrc ! audioconvert ! 'audio/x-raw-int,rate=44100,channels=1' ! mux. \
avimux name=mux ! filesink location=gst.avi
Run Code Online (Sandbox Code Playgroud)

我可以让它运行一段时间,杀死它,然后totem gst.avi显示一个带有音调的漂亮的测试卡.

但是,尝试做一些更有用的事情

gst-launch-0.10 \
filesrc location=MVI_2034.AVI ! decodebin name=dec \
dec. ! ffmpegcolorspace ! 'video/x-raw-yuv' ! mux. \
dec. ! audioconvert ! 'audio/x-raw-int,rate=44100,channels=1' ! mux. \
avimux name=mux ! filesink location=gst.avi
Run Code Online (Sandbox Code Playgroud)

它只是显示

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Run Code Online (Sandbox Code Playgroud)

然后无限期地停止.

使用decodebin滚动版本的诀窍是什么?

tim*_*day 4

啊哈...这就是我想要的:

gst-launch-0.10 \
filesrc location=MVI_2034.AVI ! decodebin name=dec \
dec. ! queue ! ffmpegcolorspace ! 'video/x-raw-yuv' ! queue ! mux. \
dec. ! queue ! audioconvert ! 'audio/x-raw-int,channels=1' ! audioresample ! 'audio/x-raw-int,rate=44100' ! queue ! mux. \
avimux name=mux ! filesink location=gst.avi
Run Code Online (Sandbox Code Playgroud)

队列元素(前导和尾随)似乎确实至关重要。

进一步的实验添加诸如视频翻转或

videorate ! 'video/x-raw-yuv,framerate=25/1'
Run Code Online (Sandbox Code Playgroud)

进入管道的视频部分一切都按预期工作。

  • 当复用或解复用时,需要有缓冲区。这就是队列元素的用武之地。您可以通过指定队列中缓冲区的数量来进一步微调它。 (2认同)