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)
T开发者_StackOverflowhank you!
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
.
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
.
精彩评论