gpt4 book ai didi

python - AppSink 方法缺失 : AttributeError: 'GstAppSink' object has no attribute 'is_eos'

转载 作者:太空宇宙 更新时间:2023-11-03 13:56:38 25 4
gpt4 key购买 nike

我正在尝试使用 AppSink 接收器从中读取样本,但对象上似乎不存在任何 AppSink 方法。

import gi
gi.require_version("Gst", "1.0")

from gi.repository import Gst
Gst.init()

pipe = Gst.parse_launch("audiotestsrc ! opusenc ! appsink name=sink")
sink = pipe.get_by_name("sink")

while not sink.is_eos():
pass

错误

Traceback (most recent call last):
File "x.py", line 9, in <module>
while not sink.is_eos():
AttributeError: 'GstAppSink' object has no attribute 'is_eos'

gstreamer 版本:

gst-inspect-1.0 version 1.14.1
GStreamer 1.14.1
https://launchpad.net/distros/ubuntu/+source/gstreamer1.0

最佳答案

appsink 接口(interface)与基本 GStreamer 接口(interface)位于不同的库中。您还需要导入 GstApp:

import gi

gi.require_version("Gst", "1.0")
gi.require_version("GstApp", "1.0")

from gi.repository import Gst, GstApp

Gst.init(None)

pipe = Gst.parse_launch("audiotestsrc ! opusenc ! appsink name=sink")
sink = pipe.get_by_name("sink")

while not sink.is_eos():
pass

关于python - AppSink 方法缺失 : AttributeError: 'GstAppSink' object has no attribute 'is_eos' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54819328/

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