Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K
Posted: 25 Jun 2020 00:57
OK, this is weird. I have been battling this all day & have been unsuccessful as of yet. I am working on a project that is Python based. The project is started via systemd scripts. Weird thing is vlc/cvlc works to an extent, it will run a 1080 vid just fine but not 4K. If I run the python app from the command line, everything works perfectly. Running the app from systemd is the wonkiness.
For instance, when it is run with the following code & service script, It will play a 1080 file but not a 4K file. If I run the python outside of systemd script, it will play a 1080 & 4k file just fine. Try it out with the following & let me know if you can figure it out. I greatly appreciate any & all help. Thanks!
EDITED: Rémi pointed me in the right direction for the dbus issue, but the bigger issue is the lack of 4K when using systemd now. Thanks Rémi!!! I've added more Environment= to the service file, but still no luck as of yet.
EDIT: ADDED VLC LOG TO REPLY
PYTHON CODE (testvlc):
SYSTEMD SCRIPT (testvlc.service) added Environment= stuff per Rémi's response, thanks!:
For instance, when it is run with the following code & service script, It will play a 1080 file but not a 4K file. If I run the python outside of systemd script, it will play a 1080 & 4k file just fine. Try it out with the following & let me know if you can figure it out. I greatly appreciate any & all help. Thanks!
EDITED: Rémi pointed me in the right direction for the dbus issue, but the bigger issue is the lack of 4K when using systemd now. Thanks Rémi!!! I've added more Environment= to the service file, but still no luck as of yet.
EDIT: ADDED VLC LOG TO REPLY
PYTHON CODE (testvlc):
Code: Select all
#!/usr/bin/env python
from subprocess import Popen, PIPE
import time
vid = 'somevideo.mp4'
cmd = 'DISPLAY=:0 cvlc -f --no-osd %s -L' % vid
Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
while True:
print("Hello!")
time.sleep(5)
Code: Select all
[Unit]
Description=Test VLC From Python Script
[Service]
User=user
Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus"
Environment="DISPLAY=:0"
Environment="XDG_RUNTIME_DIR=/run/user/1001"
Environment="XAUTHORITY=/home/ppp/.Xauthority"
ExecStart=/usr/bin/screen -D -S testvlc -m /home/user/testvlc
[Install]
WantedBy=multi-user.target