天真的,我试图将解码器链接到编码器:
$ gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! encodebin profile="application/ogg:video/x-theora:audio/x-vorbis" ! filesink location="/tmp/sound.ogg"
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:
failed delayed linking some pad of GstDecodeBin named decodebin0 to some pad of GstEncodeBin named encodebin0
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstWavParse:wavparse0: Internal data stream error.
Additional debug info:
gstwavparse.c(2293): gst_wavparse_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstWavParse:wavparse0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
当然,这里缺少一些东西。什么事?
注意,这有效:
gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! audioconvert ! vorbisenc ! oggmux ! filesink location="/tmp/sound.ogg"
答案 0 :(得分:1)
gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! encodebin profile="application/ogg:video/x-theora:audio/x-vorbis" ! filesink location="/tmp/sound.ogg"
encodebin的键盘中没有模板,因此gst-launch不知道要请求哪个键盘(视频或音频)。您可以使用以下命令明确要求其中之一:
gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! enc.audio_%u encodebin name=enc profile="application/ogg:video/x-theora:audio/x-vorbis" ! filesink location="/tmp/sound.ogg"
请注意,我们如何给encodebin命名为“ enc”,然后将解码bin链接到音频键盘,因为我们知道这是一个纯音频文件。
如果我们同时具有视频和音频,则需要显式地将视频垫从解码bin链接到encodebin的视频垫,依此类推。您也将给名字一个bindbin并链接它们。类似于:decodebin name=dec dec.audio_%u ! queue ! enc.audio_%u dec.video_%u ! queue ! enc.video_%u
作为最后的建议,建议在每个可以分支到多个路径的元素之后都添加一个队列,例如解码bin。当您有一个以上的输出时,这是强制性的,但是即使只有一个输出,也不会损害它。