1

I want to display a video on a monitor via systemd. my systemd script looks like this:

[Unit]
Description=example script

[Service]
TimeoutStartSec=0
ExecStart=bash /home/pi/script.sh
Type=simple
User=pi

ExecStop=/usr/bin/killall vlc

[Install]
WantedBy=multi-user.target

and is placed at /etc/systemd/system/vlc.service. The shell script is this:

DISPLAY=:0 vlc --fullscreen /home/pi/file.mp4

running the script manually as the pi user works fine - the video and sound play. Running the script via systemctl start vlc loads up VLC and "plays" the file (the correct runtime is shown and the scrub bar moves) but no sound or video plays.

I've tested this on a pi zero w and pi 4b and both have the same issue, running the latest, updated raspberry pi OS image. What should I try next?

1
  • Did you find a solution for this in the meantime? I have the same issue since I switched from omxplayer to cvlc (because omxplayer is not running anymore on newer OSes) Jan 19, 2023 at 13:23

1 Answer 1

1

Found a solution for me in the RPi forums, maybe it helps you too.

Add (or change) this line in /boot/config.txt:

dtoverlay=vc4-fkms-v3d

From what I understood, kms runs all on the kernel and has more restrictive permissions on what may paint on layers, and fkms (fake kms) still allows VLC to paint on the screen when started as systemd service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.