python - gstreamer 动态管道文件接收器添加,出现未协商错误

标签 python dynamic gstreamer pipeline pygst

这有效:

gst-launch -e v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! tee name=splitter ! queue ! autovideosink splitter. ! queue ! theoraenc ! oggmux ! filesink location=testogg.ogg

我正在尝试使用 python 和 pygst 以动态方式执行相同操作,autovideosink 分支始终存在,并且在用户输入后我想附加文件接收器。

这是动态连接代码:

    fileSink = self.getFileSink()
    pad = fileSink.get_static_pad('sink')
    pad.set_blocked_async(True, self.padBlockedOnRecordStart, None)
    self.player.add(fileSink)
    fileSink.set_state(gst.STATE_PLAYING)
    self.player.get_by_name('splitter').link(fileSink)
    pad.set_blocked_async(False, self.padBlockedOnRecordStart, None)

链接时出现此错误:

Error: GStreamer encountered a general stream error. gstbasesrc.c(2625): gst_base_src_loop (): /GstPipeline:player/GstV4l2Src:video:
streaming task paused, reason not-negotiated (-4) 

有什么想法吗?

最佳答案

现在可以了!解决方案是在 capsfilter 中添加“format”。以前的大写过滤字符串是:

caps = gst.Caps('video/x-raw-yuv,width=640,height=480,framerate=30/1')

现在是:

caps = gst.Caps('video/x-raw-yuv,format=(fourcc)I420,width=640,height=480,framerate=30/1')

问题是我的网络摄像头默认输出像素格式是“YUYV”,而我的 fileSink Bin 中的 theoraenc 元素不接受此格式,因此添加 format=(fourcc)I420 有所帮助。 我仍然不知道为什么之前的 capsfilter 字符串与 gst-launch 一起使用,但我现在不介意。 感谢您的帮助

关于python - gstreamer 动态管道文件接收器添加,出现未协商错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18553197/

相关文章:

python - 使用 rpy2 : cannot find R package that is installed

python - Python 类方法的示例用例是什么?

python - 添加对对流层中现有 sns 主题的订阅

C、字符串输入不带空格或制表符

go - gstreamer网络摄像头vp9enc滞后

windows - GStreamer 在 Windows 上缺少插件

python gevent : unexpected output in KeyboardInterrupt

c# - var array = new [] {d, "hello"} 隐式输入为 dynamic[] 而不是 string[] ?为什么?

haskell - 我可以在运行时从字符串编译haskell函数(使用插件)吗?

c++ - gstreamer 和 Qt 与 ARM 上的 nvidia