JE-Random-Tech / ProJEcts

All code to the JE Random Tech Videos can be found here
0 stars 2 forks source link

Dbus cannot connect to the OMXPlayer #2

Open Vorosh opened 3 years ago

Vorosh commented 3 years ago

Hey! I downloaded a new raspbian image (Buster. Release date: March 4th 2021 ). I decided to load your player and it doesn't work. The installation was done according to your instructions. Here is the error "Dbus cannot connect to the OMXPlayer" Can you test it on your new OS?

JE-Random-Tech commented 3 years ago

Yes, I will. I remember running into this issue as well. You might want to increase the Gpu memory even more than 512 depending on your raspberrypi model

JE-Random-Tech commented 3 years ago

It works for me. So i started it from scratch now and noticed I have forgotten to add the line sudo apt-get install -y libdbus-1-dev. I will change that in the video later. So make sure you have this installed and restart the pi. Are the videos at /home/videos/vid0.mp4? Do you have all 7 videos specified so vid0.mp4, vid1.mp4 till vid7.mp4 as I have noticed it makes the same error. Also could you send the full error especially at which line it fails?

Vorosh commented 3 years ago

Hey! I did a full install including sudo apt-get install -y libdbus-1-dev. I decided to change the video to other files with a resolution of 1920x1080. I changed the GPU memory to 616, it worked for 5 minutes. The video toggle buttons worked. But after 5 minutes they stopped working and the terminal displayed the following error:

75Exception in thread Thread-77: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "testomx.py", line 27, in on_press changeTo(videotochannelmap[channel]) File "testomx.py", line 48, in changeTo player[currentIndex]= newVideoInit(currentIndex) File "testomx.py", line 67, in newVideoInit y= OMXPlayer(files[videoIndex], args=['--no-keys','--no-osd', '-b', '--layer', '1', '--video_queue', '1', '-o','hdmi' ], dbus_name='omxplayer.player'+str(videoIndex), pause=True) File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 154, in __init__ self.load(source, pause=pause) File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 251, in load self._load_source(source) File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 163, in _load_source self._connection = self._setup_dbus_connection(self._Connection, self._bus_address_finder) File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 236, in _setup_dbus_connection raise SystemError('DBus cannot connect to the OMXPlayer process') SystemError: DBus cannot connect to the OMXPlayer process

JE-Random-Tech commented 3 years ago

I think I figured it out while writing the below answer. The issue is actually in the code as it kills the video process and starts it though the dbus name is the same. So solutions could be to change the code so that the videos aren't reinitialized but rather stopped and then jumped to timemark 0 or change the way dbus names are given to the processes. As written below I think the jumping around in videos was a little slow but maybe it works better for your video files.

(Thanks. What happens if you decrease the amount of different videos played and reduce the quality of them. Maybe further increasing the gpu memory helps.

I also found these issues https://github.com/willprice/python-omxplayer-wrapper/issues/72 (at the bottom) https://github.com/willprice/python-omxplayer-wrapper/issues/65)

that talk about it. As fix the suggestion is to add a dbus name.

Maybe you have to try the suggestion to switch between vidoes by cutting all in one and jump to time markers to change the video, but i think i tried this and the jumping around was to slow for longer videos.)

Vorosh commented 3 years ago

Thanks for your reply. Can you tell me how to implement "change the way dbus names are given to the processes" using your example code?

The videos I use are quite long. Therefore, the method to combine all videos into one and make a time transition is not suitable for me.

JE-Random-Tech commented 3 years ago

Yeah sure sry my answer was a bit short.

https://github.com/JE-Random-Tech/ProJEcts/blob/e421b75c9b155efdbf32875456d9ddc76ed2246d/Haptic%20Board/HapticBoard.py#L65 https://github.com/JE-Random-Tech/ProJEcts/blob/e421b75c9b155efdbf32875456d9ddc76ed2246d/Haptic%20Board/HapticBoard.py#L70 In those lines the dbusname is set to omxplayer.player0 etc. to give unique names you could use eg the current date and time and concat it as string. Though as I have written I am not sure if that will fix the problem. It was mentioned in one of the issues I posted earlier. You can fork this repo and work on the code and then create a pull request if it works fine.