To run this VLC command as a service on Raspbian (Raspberry Pi OS) at startup, the best approach is to use a systemd
service.
Open a terminal and run:
sudo nano /etc/systemd/system/cvlc-video.service
[Unit]
Description=Looping CVLC Video Playback
After=network.target sound.target graphical.target
[Service]
User=pi
ExecStart=/usr/bin/cvlc --no-osd --fullscreen --loop --no-video-title-show --no-sub-autodetect-file --quiet --drop-late-frames --skip-frames /home/default/video.mp4
Restart=always
RestartSec=5
StandardOutput=null
StandardError=null
[Install]
WantedBy=graphical.target
π Change
User=pi
if you're using a different user.
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable cvlc-video.service
sudo systemctl start cvlc-video.service
systemctl status cvlc-video.service
- This runs after the GUI starts, because
graphical.target
ensures X11 is ready. - You might need to run this with a valid DISPLAY if itβs running outside a login session. You can tweak the service like this if needed:
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
Want it to run on a headless system, or should it auto-login to the GUI first?