2

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?

  • Do you just want a short video to play to completion, or should the user be able to interrupt playback? – bobstro Jan 11 '18 at 21:25
1

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.

| improve this answer | |
  • Hi! thanks for your answer. This worked! however, the video played a little late. I want it to play as soon as the pi is turned on. it took about 10 seconds to play. I removed the sleep. Any idea how to make it play immediately? – unconditionalcoder May 30 '16 at 4:01
  • @unconditionalcoder what file format are you using? – Mohammad Ali May 30 '16 at 4:01
  • my video is an mp4. Is that the format you are asking about? – unconditionalcoder May 30 '16 at 4:03
  • @unconditionalcoder yes, you could attempt to go into the config page with the command sudo rasps-config and setting gpu ram to like 256 or 512 mb of ram but realistically it won't make a huge difference as the majority of your wait time is boot up time, the best thing you could do is to try and purchase a higher speed sd card. If this answer has helped you please click the green checkmark to the left of it to indicate that it has helped you – Mohammad Ali May 30 '16 at 4:05
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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