windows上的gstreamer playbin设置uri

2024-04-27 14:44:27 发布

您现在位置:Python中文网/ 问答频道 /正文

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

http://pygstdocs.berlios.de/pygst-tutorial/playbin.htmlhttp://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上的文件路径??在

另外,在这一行代码中我需要做什么特别的事情吗?在

^{pr2}$

谢谢你!在


Tags: 文件路径httpwindowshtmldemp3tutorial
2条回答

您注意到实际的路径是file:///C:/file:/C:/voice.mp3?在

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

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

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

使用这样的方法:

^{pr2}$

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

相关问题 更多 >