Gstreamer:如何将decodebin与encodebin链接? (错误:未能成功延迟链接...的某部分) [英] Gstreamer: how to link decodebin to encodebin? (error: failed delayed linking some pad of ...)

查看:375
本文介绍了Gstreamer:如何将decodebin与encodebin链接? (错误:未能成功延迟链接...的某部分)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

天真的,我试图将解码器链接到编码器:

Naively, I am trying to link decodebin to 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 ...

当然,这里缺少一些东西.什么事?

Surely, there is something missing. What is it?

注意,这有效: 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不知道要请求哪个暂存区(视频或音频).您可以使用以下命令明确要求其中之一:

encodebin doesn't have templates in their pads so gst-launch doesn't know which pad to request (video or audio). You can explicitly ask for one of them using:

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链接到音频键盘,因为我们知道这是一个纯音频文件.

Notice how we give encodebin a name "enc" and then we link decodebin to the audio pad as we know that this is an audio-only file.

如果我们同时拥有视频和音频,则需要显式地将视频垫从解码bin链接到encodebin的视频垫,依此类推.您也将给名字一个bindbin并链接它们.类似于:decodebin name=dec dec.audio_%u ! queue ! enc.audio_%u dec.video_%u ! queue ! enc.video_%u

If we had both video and audio you'd need to link explicitly the video pad from decodebin to the video pad of encodebin and so forth. You would give a name to decodebin as well and link them. Something like: decodebin name=dec dec.audio_%u ! queue ! enc.audio_%u dec.video_%u ! queue ! enc.video_%u

作为最后的建议,建议在每个可以分支到多个路径的元素之后都添加一个队列,例如解码bin.当您有一个以上的输出时,这是强制性的,但即使只有一个输出,也不会损害它.

As a final suggestion, it is recommended to have a queue after every element that can branch of into multiple paths, like decodebin. It is mandatory when you have more than one output from it, but doesn't hurt to have it even if you only have one.

这篇关于Gstreamer:如何将decodebin与encodebin链接? (错误:未能成功延迟链接...的某部分)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆