You can absolutely do this without the need for a GUI desktop or logging in. I used this technique to have a RPi Zero 1.3 (no network) boot directly into omxplayer
continually looping a video -- a 2 hour aquarium loop in my case. Here's how I did it using systemd
:
Create a file in /etc/systemd/system/omxplayer.service
containing:
[Unit]
Description=Ambient scenery display
Before=systemd-user-sessions.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/omxplayer -r --loop --vol -6000 -o hdmi "/path/to/video.mp4"
Type=simple
User=youruser
ExecStop=/usr/bin/killall omxplayer
User=youruser
Enable the service with sudo systemctl enable omxplayer
.
The RPi should boot and launch omxplayer
early in the boot process. The console is useless at this point, and the Pixel desktop inaccessible unless you add something to kill omxplayer
when needed. The player runs in the background, so pressing [esc]
won't exit it. If the RPi is networked, you can access it via the network normally.
Note the use of the omxplayer
parameters: --vol -6000
for silent (change to suit), -r
to adjust the framerate to the video, --loop
to loop continuously (with a short blank between loops, unfortunately), and -o hdmi
to force HDMI output.
osxplayer.bin
. i am assuming you meanomxplayer.bin
(note the 's' instead of 'm') – Shreyas Murali May 26 '17 at 18:42