gstreamer playbin - 在 Windows 上设置 uri

发布于 2024-08-21 01:44:31 字数 1056 浏览 6 评论 0原文

我正在尝试使用此站点上的 CLI 示例播放一些音频文件:

http:// pygstdocs.berlios.de/pygst-tutorial/playbin.html http://pygstdocs.berlios.de/pygst-tutorial/playbin.html

我在 Windows 上,读取文件时出错。我指定 以下路径:

$ python cliplayer.py C:\\voice.mp3

0:00:00.125000000  3788   009DA010 ERROR                basesrc
gstbasesrc.c:2834:gst_base_src_activate_pull:<source> Failed to start in
pull mode
Error: Could not open resource for reading.
..\..\..\Source\gst-plugins-base\ext\gio\gstgiosrc.c(324):
gst_gio_src_get_stream ():
/GstPlayBin2:player/GstURIDecodeBin:uridecodebin0/GstGioSrc:source:
Could not open location file:///C:/file:/C:/voice.mp3 for reading: Error
opening file: Invalid argument

我应该如何在Windows上指定文件路径?

另外,这行代码有什么特别需要做的吗?

self.player.set_property("uri", "file://" + filepath)

谢谢你!

I am trying to play some audio files with the CLI example on this site:

http://pygstdocs.berlios.de/pygst-tutorial/playbin.html
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html

I am on windows and it is giving error while reading the file. I specified
the following path:

$ python cliplayer.py C:\\voice.mp3

0:00:00.125000000  3788   009DA010 ERROR                basesrc
gstbasesrc.c:2834:gst_base_src_activate_pull:<source> Failed to start in
pull mode
Error: Could not open resource for reading.
..\..\..\Source\gst-plugins-base\ext\gio\gstgiosrc.c(324):
gst_gio_src_get_stream ():
/GstPlayBin2:player/GstURIDecodeBin:uridecodebin0/GstGioSrc:source:
Could not open location file:///C:/file:/C:/voice.mp3 for reading: Error
opening file: Invalid argument

How should I specify the file path on windows??

Also, is there anything special I need to do in this line of code?

self.player.set_property("uri", "file://" + filepath)

Thank you!

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

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

发布评论

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

评论(2

玉环 2024-08-28 01:44:31

正如您可能怀疑的那样,这段代码写得相当糟糕:

for filepath in sys.argv[1:]:
    # ...
    self.player.set_property("uri", "file://" + filepath)

使用类似这样的内容:

'file:' + urllib.pathname2url(filepath)

并(在命令行中)以正常的 Windows 表示法指定文件路径,例如 C:\a\b.mp3

As you may have suspected, this code is rather badly written:

for filepath in sys.argv[1:]:
    # ...
    self.player.set_property("uri", "file://" + filepath)

Use something like this:

'file:' + urllib.pathname2url(filepath)

and (in the command line) specify the file path in normal Windows notation, e.g. C:\a\b.mp3.

你是我的挚爱i 2024-08-28 01:44:31

您是否注意到您获得的实际路径是 file:///C:/file:/C:/voice.mp3

正确的路径应该是:file:///C:/path/to/voice.mp3

Did you notice the actual path you've got is file:///C:/file:/C:/voice.mp3?

The correct path should be: file:///C:/path/to/voice.mp3.

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