簡體   English   中英

Gstreamer:如何將decodebin與encodebin鏈接? (錯誤:未能成功延遲連接…的某物)

[英]Gstreamer: how to link decodebin to encodebin? (error: failed delayed linking some pad of …)

天真的,我正在嘗試將decodebin鏈接到encodebin:

$ 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" gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! audioconvert ! vorbisenc ! oggmux ! filesink location="/tmp/sound.ogg"

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”,然后我們將decodebin鏈接到音頻墊,因為我們知道這是一個純音頻文件。

如果我們同時擁有視頻和音頻,則需要明確地將視頻墊從解碼bin鏈接到encodebin的視頻墊,依此類推。 您也將給名字一個bindbin並鏈接它們。 像這樣的東西: decodebin name=dec dec.audio_%u ! queue ! enc.audio_%u dec.video_%u ! queue ! enc.video_%u decodebin name=dec dec.audio_%u ! queue ! enc.audio_%u dec.video_%u ! queue ! enc.video_%u

作為最后的建議,建議在每個可以分支到多個路徑的元素之后都有一個隊列,例如解碼bin。 當您有一個以上的輸出時,這是強制性的,但是即使只有一個輸出,也不會損害它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM