happyleavesaoc / gstreamer-player

MIT License
1 stars 5 forks source link

gst-resource-error-quark #1

Open curiouswala opened 7 years ago

curiouswala commented 7 years ago

The project is just what i needed but sadly doesn't work for me. Python 3.5.2 under Linux

>>> from gsp import GstreamerPlayer
>>> player = GstreamerPlayer(None)
>>> player.queue("2.mp3")
gst-resource-error-quark: Could not open resource for reading. (5)

gstreamer work for me with my code i wrote a hacky version of the wrapper but really want queue management. Thanks for the code btw

happyleavesaoc commented 7 years ago

Hi, specify the full path like so:

uri = 'file://' + os.path.abspath('2.mp3')

curiouswala commented 7 years ago

Here is the code

from gsp import GstreamerPlayer
import os

filename = '1cut.mp3'
print(os.path.exists(os.path.abspath(filename))) # This is true for me
player = GstreamerPlayer(None)
uri = 'file://'+os.path.abspath(filename)
player.queue(uri)

Here is the new result

/home/hasan/moodio_env/bin/python /home/hasan/PycharmProjects/audioplayer/wrapplayer.py
Process GstreamerProcess-2:
Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/managers.py", line 709, in _callmethod
    conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/home/hasan/moodio_env/lib/python3.5/site-packages/gsp/__init__.py", line 94, in run
    self.media(uri)
  File "/home/hasan/moodio_env/lib/python3.5/site-packages/gsp/__init__.py", line 118, in media
    self.state = STATE_PLAYING
  File "/home/hasan/moodio_env/lib/python3.5/site-packages/gsp/__init__.py", line 166, in state
    self._manager[ATTR_STATE] = state
  File "<string>", line 2, in __setitem__
  File "/usr/lib/python3.5/multiprocessing/managers.py", line 713, in _callmethod
    self._connect()
  File "/usr/lib/python3.5/multiprocessing/managers.py", line 700, in _connect
    conn = self._Client(self._token.address, authkey=self._authkey)
  File "/usr/lib/python3.5/multiprocessing/connection.py", line 487, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.5/multiprocessing/connection.py", line 614, in SocketClient
    s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory

Process finished with exit code 0

mp3 file exists in the same dir Could virtualenv affect it in any way?

happyleavesaoc commented 7 years ago

Try dropping the file://.

jeena commented 6 years ago

I have the same problem.

tschmidty69 commented 6 years ago

I have a similar issue @happyleavesaoc I can play from the command line and from within my python venv for hass

Python 3.6.3 (default, Oct  3 2017, 21:45:48)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gsp import GstreamerPlayer
>>> pipeline = 'mpegaudioparse ! mpg123audiodec ! audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo'
>>> player = GstreamerPlayer(pipeline)
>>> player.queue('https://myserver/api/tts_proxy/a0f58f7e9238b8d577822294c20673c243bd091f_en-gb-wls_8567674757942596877_amazon_polly.mp3')
>>> gst-resource-error-quark: Error while seeking in file "/tmp/snapfifo". (11)

But when trying to play withing hass with the same parameters

 ERROR (SyncWorker_2) [gsp] gst-resource-error-quark: Could not open resource for reading. (5)
pitoulambert commented 4 years ago

I got the same problem while using the bbc/brave (audio/video) api editor

ERROR: [ output1] GStreamer error from sink: gst-resource-error-quark: Error while writing to file "/usr/local/share/brave/output_images/img_19777.jpg". (10) ERROR: [ output1] GStreamer error debug: gstmultifilesink.c(793): gst_multi_file_sink_write_buffer (): /GstPipeline:pipeline25/GstMultiFileSink:sink: No such file or directory ERROR: [ output1] GStreamer error message: Error while writing to file "/usr/local/share/brave/output_images/img_19777.jpg".

I need your help please