Python 和 Gstreamer

发布于 2024-08-30 14:45:49 字数 291 浏览 5 评论 0原文

我正在创建一个流应用程序,使用 GStreamer 和 TCP 管道,并实现了启动、暂停和停止。

但问题是,我无法寻找,我尝试从服务器端更改播放值,然后我在客户端尝试,最后尝试同时更改两者的值,但在所有情况下它不起作用。我什至尝试暂停播放然后继续但没有任何反应。

我在搜索和音量方面遇到了这个问题。请帮忙,我到处搜索但找不到任何有用的东西。

这是我用于寻找

self.pipeline.seek_simple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, time) 的代码

I'm creating a streaming application, using GStreamer with TCP pipeline, and i implemented start, pause, and stop.

but the problem is, that i can't seek, i tried to change the playback value from the server side, then i tried on the client side, and Finally tried to change the value on both at the same time, but in all cases it doesn't work. and I even tried to pause the playback then continue but nothing happens.

I'm having this problem with the seek and the volume. Any help please, I searched everywhere but i couldn't find anything that worked.

this is the code that i use for seeking

self.pipeline.seek_simple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, time)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山有枢 2024-09-06 14:45:49

如果您还没有找到它,也许这可以解决问题:

Gstreamer 中的查找是通过eek() 和eek_simple() 方法完成的。为了能够进行搜索,您还需要告诉 Gstreamer 它应该进行哪种类型的搜索。在下面的示例中,我们将使用 gst.FORMAT_TIME 格式常量,您可能会猜到它会执行时间搜索。 :D 我们还将使用 query_duration() 和 query_position() 方法来获取文件长度以及文件当前播放的时间。 Gstreamer 默认使用纳秒,因此您必须对此进行调整。

下面是一个示例:使用 GStreamer 进行查找

Perhaps this could do the trick if you didn't find it yet:

Seeking in Gstreamer is done with the seek() and seek_simple() methods. To be able to seek you will also need to tell Gstreamer what kind of seek it should do. In the following example we will use a gst.FORMAT_TIME format constant which will as you may guess do a time seek. :D We will also use the query_duration() and query_position() methods to get the file length and how long the file has currently played. Gstreamer uses nanoseconds by default so you have to adjust to that.

Here is an example: Seeking with GStreamer

半透明的墙 2024-09-06 14:45:49

也许您忘记让总线监听搜索事件。尝试在设置管道后将其放入:

self.bus = self.pipeline.get_bus()
self.bus.add_signal_watch()   

如果这不起作用,请发布更多代码。

Maybe you forgot to have the bus listening for seek events. Try putting this in after setting up your pipeline:

self.bus = self.pipeline.get_bus()
self.bus.add_signal_watch()   

If this doesn't work then please post more code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文