我正在尝试重新编码包含一些video/x-h264
和一些audio/x-raw
的MKV文件的音频部分。我不能就这么把MKV脱了出来再修改它。甚至简单地说:
gst-launch-1.0 filesrc location=test.mkv ! matroskademux name=demux \
matroskamux name=mux ! filesink location=test2.mkv \
demux.video_00 ! mux.video_00 \
demux.audio_00 ! mux.audio_00
不幸地失败于:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstMatroskaDemux:demux: Delayed linking failed.
Additional debug info:
../gstreamer/gst/parse/grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstMatroskaDemux:demux:
failed delayed linking pad video_00 of GstMatroskaDemux named demux to pad video_00 of GstMatroskaMux named mux
WARNING: from element /GstPipeline:pipeline0/GstMatroskaDemux:demux: Delayed linking failed.
Additional debug info:
../gstreamer/gst/parse/grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstMatroskaDemux:demux:
failed delayed linking pad audio_00 of GstMatroskaDemux named demux to pad audio_00 of GstMatroskaMux named mux
ERROR: from element /GstPipeline:pipeline0/GstMatroskaDemux:demux: Internal data stream error.
Additional debug info:
../gst-plugins-good/gst/matroska/matroska-demux.c(5715): gst_matroska_demux_loop (): /GstPipeline:pipeline0/GstMatroskaDemux:demux:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
我对上述转码的最佳尝试是:
gst-launch-1.0 -v filesrc location=test.mkv ! matroskademux name=demux \
matroskamux name=mux ! filesink location=test2.mkv \
demux.video_00 ! queue ! 'video/x-h264' ! h264parse ! mux. \
demux.audio_00 ! queue ! rawaudioparse ! audioconvert ! audioresample ! avenc_aac ! mux.
结果是一样的。删除pad名称audio_00
会导致gst
卡在PREROLLING
上。
我曾见过一些人面对类似的问题:
就像这样,只保留视频或音频作品。
发布于 2020-05-05 13:12:54
我认为rawaudioparse
不应该在这里。我试过你的管道,也麻烦了。我刚刚想出了一些我应该做的事情,它看起来很管用:
filesrc location=test.mkv ! matroskademux \
matroskademux0. ! queue ! audioconvert ! avenc_aac ! matroskamux ! filesink location=test2.mkv \
matroskademux0. ! queue ! h264parse ! matroskamux0.
就我的情况而言,音频是:
Stream #0:0(eng): Audio: pcm_f32le, 44100 Hz, 2 channels, flt, 2822 kb/s (default)
另一种格式可能需要额外的转换。
发布于 2020-05-05 17:32:34
问题是pads、video_00
和audio_00
已经改名为video_0
和audio_0
。使用gst-inspect-1.0 matroskademux
可以看到这一点,这表明pads的格式现在读取video_%u
。请注意,gstreamer的一些文档页没有被更新以反映这一点。
第一个命令MKV到MKV应改为:
gst-launch-1.0 filesrc location=test.mkv ! matroskademux name=demux \
matroskamux name=mux ! filesink location=test2.mkv \
demux.video_0 ! queue ! mux.video_0 \
demux.audio_0 ! queue ! mux.audio_0
(请注意添加的queue
s)
第二个命令MKV到MKV重新编码音频应该是:
gst-launch-1.0 -v filesrc location=test.mkv ! matroskademux name=demux \
matroskamux name=mux ! filesink location=test2.mkv \
demux.video_0 ! queue ! 'video/x-h264' ! h264parse ! mux. \
demux.audio_0 ! queue ! rawaudioparse ! audioconvert ! audioresample ! avenc_aac ! mux.
如果需要的话,可以通过不指定pads和使用帽过滤器来实现同样的结果。
感谢用户Florian提供了一个工作管道。
https://stackoverflow.com/questions/61606554
复制相似问题