gpt4 book ai didi

Python + GStreamer - 无法连接

转载 作者:太空宇宙 更新时间:2023-11-03 19:36:05 24 4
gpt4 key购买 nike

我在将音频和视频合并到一个文件中时遇到问题。 Python 代码如下所示;

            filmPipe = gst.Pipeline("filmPipe")
filmSrc = gst.element_factory_make("multifilesrc", "filmSrc")
filmSrc.set_property("location", "pictures/%d.png")
filmFilt1 = gst.element_factory_make("capsfilter", "filmFilt1")
filmCap1 = gst.Caps("image/png,framerate=5/1,pixel-aspect-ratio=1/1")
filmFilt1.set_property("caps", filmCap1)
filmPngDec = gst.element_factory_make("pngdec", "filmPngDec")
filmff = gst.element_factory_make("ffmpegcolorspace", "filmff")
filmFilt2 = gst.element_factory_make("capsfilter", "filmFilt2")
filmCap2 = gst.Caps("video/x-raw-yuv")
filmFilt2.set_property("caps", filmCap2)
filmTheora = gst.element_factory_make("xvidenc", "filmTheora")
filmQue = gst.element_factory_make("queue", "filmQue")
filmOggmux = gst.element_factory_make("ffmux_mp4", "filmOggmux")
filmFilesink = gst.element_factory_make("filesink", "filmFilesink")
filmFilesink.set_property("location", self.movPath)
musicSrc = gst.element_factory_make("filesrc", "musicSrc")
musicSrc.set_property("location", self.musicPath)
musicDec = gst.element_factory_make("ffdec_mp3", "musicDec")
musicEnc = gst.element_factory_make("lame", "musicEnc")
musicQue = gst.element_factory_make("queue", "musicQue")

filmPipe.add(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmQue, filmOggmux, filmFilesink)
filmPipe.add(musicSrc, musicDec, musicEnc, musicQue)
gst.element_link_many(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmQue, filmOggmux, filmFilesink)
gst.element_link_many(musicSrc, musicDec, musicEnc, musicQue, filmOggmux, filmFilesink)
filmPipe.set_state(gst.STATE_PLAYING)

这将返回以下错误:

Traceback (most recent call last):
File "app.py", line 100, in movGen
gst.element_link_many(musicSrc, musicDec, musicEnc, musicQue, filmOggmux, filmFilesink)
gst.LinkError: failed to link filmOggmux with filmFilesink

有人知道我哪里出了问题,或者如何解决这个问题吗?

最佳答案

您正在将 2 次 filmOggmux 链接到 filmFilesink:这是不允许的,只能有一个链接。

尝试删除第二个中的 filmFilesink gst.element_link_many() .

关于Python + GStreamer - 无法连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3484953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com