I'm having trouble creating my own splash screen for my Raspberry Pi 3. I began by creating a script which plays a short video and it works when I run it on it's own. I am following this tutorial but whenever I reboot, my video does not play. I know this tutorial is outdated. Is there anyway to do this on the raspberry pi 3?
2 Answers
One of the advantages systemd provides is more granular control over when in the boot process things are executed. Provided you don't have any network or other dependencies, you can kick off video playback early in the process. I've used the following service file definition to kick off a slide show display early in the boot process with debian stretch:
[Unit]
Description=Splash screen
DefaultDependencies=no
After=local-fs.target
[Service]
ExecStart=/usr/bin/omxplayer -b /path/to/video.mp4
StandardInput=tty
StandardOutput=tty
[Install]
WantedBy=sysinit.target
Save this to a file (e.g. /etc/systemd/system/splash.service) and enable it with sudo systemctl enable splash.
The key is the After= statement that designates local filesystem availability as the only dependency, meaning this should kick off very early in the boot process. The problem with using /etc/rc.local is that, to be sure programs will work, it has to wait for the network and other targets to be available, so only kicks off near the end of the boot process. The "systemd way" allows for more granular specification of dependencies.
The -b option directs omxplayer to blank the screen before playback.
To get a truly silent boot, you have to specify some other options, but I am restricting this answer specifically to launching a video early in the boot process.
- 3,978
- 15
- 27
If all you wish to do is to play a video on boot please open up /etc/rc.local using the following command:
sudo nano /etc/rc.local
Then on the line just above the one that says exit 0 Enter the following line:
omxplayer /path/mohammad/is/awesome.mp4 &
Be sure to replace the file path with your actual file path. Furthermore if you wish to have the video loop please use the line below instead of the one above.
omxplayer --loop /path/mohammad/is/awesome.mp4 &
After making the desired edits to the file please save and close the file then reboot your pi to see the changes take effect.
- 2,373
- 1
- 12
- 18