Adding a Startup Movie to your Raspberry Pi

Hey All,

So I’ve been playign with trying to do a boot image or a boot movie with the Raspberry Pi for a while now, and all the comments and tips keep going back to a tutorial on how to boot a static image.  It works, but there are a lot of problems with it like failing gracefully and not returning the console window back if you aren’t booting to X.  So I decided to come up with another way.  This is based off the tutorial found here: http://www.edv-huber.com/index.php/problemloesungen/15-custom-splash-screen-for-raspberry-pi-raspbian and looks like this when finished:

Instead of using the program fbi, we will use omxplayer to playback a video file while the Raspberry Pi is booting in the background.

First off, you will want to copy the 15 to 20 second movie file to your Raspberry Pi device.  Anything shorter and the video will end before it’s finished booting and you will continue to see the kernel messages.  You can use any video file that omxplayer can play back, but I like .mov and .mp4 files.

  • You will need to edit your /boot/cmdline.txt file:
    • sudo nano /boot/cmdline.txt
  • Add quiet to the end of the line. It will look something like this:
    • dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet
    • Make sure that is all on one line.
  • Press ctrl-x, type y to confirm save, then press enter to return to the command line.
  • Copy your video somewhere to the Raspberry Pi.  I keep mine in /home/pi/ and call the video video.mov
  • You will now need to create a startup script that will run omxplayer at bootup.  I have modified the script from the above link.
    • sudo nano /etc/init.d/asplashscreen

#! /bin/sh
### BEGIN INIT INFO
# Provides:          asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:      
# Default-Start:     S
# Default-Stop:
# Short-Description: Show custom splashscreen
# Description:       Show custom splashscreen
### END INIT INFO

do_start () {

    omxplayer /home/pi/video.mov &  
    exit 0
}

case "$1" in
  start|"")
    do_start
    ;;
  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  stop)
    # No-op
    ;;
  status)
    exit 0
    ;;
  *)
    echo "Usage: asplashscreen [start|stop]" >&2
    exit 3
    ;;
esac

:

 

  • Press ctrl-x, y to confirm saving, and press enter to return to the command line
  • Now you need to set the file to be executable
    • sudo chmod a+x /etc/init.d/asplashscreen
  • And activate it
    • sudo insserv /etc/init.d/asplashscreen

You should now be ready to go!

Reboot your Pi and enjoy the startup movie.

-Shea

46 thoughts on “Adding a Startup Movie to your Raspberry Pi

  1. Pingback: Adding a Startup Movie to your Raspberry Pi | Raspberry World

  2. Pingback: Adding a Startup Movie to your #RaspberryPi | Raspberry PiPod

  3. Hi,

    Good Tutorial,

    I Have one doubt how to connect raspberry pi to our laptop?i mean how to see our raspberry pi screen in our laptop..please tell me..i have laptop but iam unable to see output..it supports only hdmi cable…

  4. Pingback: หน้าจอบูต Raspberry Pi แบบโฉบเฉี่ยวแหวกแนว | Raspberry Pi Thailand

  5. Any idea what codec/fps/resolution/etc is best for omxplayer on the pi? I have Adobe After effects and making these kinds of little files is stupid easy/fast. Just need 2d graphics to use and the type of file output.

  6. Pingback: Custom Pi bootup screen | I like Pi

  7. Pingback: How to Add a Startup Movie to your Raspberry Pi @RaspberryPi #piday #raspberrypi « adafruit industries blog

  8. Pingback: Adding a Startup Movie to your Raspberry Pi | Shea Silverman's Blog - Pi News

  9. Pingback: Adding a Startup Movie to your Raspberry Pi

  10. It does not work.
    I followed the tutorial step by step but without success. The system throws the following error:

    Startpar: Service (s) returned failure asplashscreen failed.

    The video has a resolution of 640×480. can be a problem resolution?

    I used the windows notepad to copy the script and then I moved to the raspberry. I have reviewed many times the script, but it’s perfect. I do not know to try.

    Nobody same thing happens?

    Sorry for my bad English.

    A greeting.

    • It might be a line ending problem. Notepad will save with dos line endings and you need UNIX line endings. You should be able to easily find a windows tool to convert the file before you transfer it. Or type it in on the pi itself using an editor like nano.

  11. hi sheasilverman.com
    Do you know rememeber me ?
    5 month ago,I’m post on the my website that how to install your neogeo.
    congratulation,It publish your gaming book about raspberrypi.

    i saw your this post.
    But I’m recommendation that raspberrypi foundation mark change your mark.

    I have been change raspberrypi foundation mark.
    this movie refer.
    http://www.youtube.com/watch?feature=player_embedded&v=GUYyGKxp7Fw

    and how to post is here.
    http://www.rasplay.org/?p=6371

  12. Hello!
    Thanks for this nice article.
    I have done every step. I can see my image but, after seeing all coding; just before asking password.
    Could you tell me why my image is appearing so late?
    Is there anyway to fix this?
    Thank you so much in advance 🙂
    Cagri.

  13. If you turn off the logs and logo rather than “quiet” you wont get any boot messages with this method.
    “dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty3 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait logo.nologo loglevel=3”

  14. thank you for ur blog it works vrey nicely.. but i am not understanding the code is it possible giving a brief explanation for that.. thank you..

  15. i tried this word for word and nano returned”[Error writing /ect/init.d/aslashscreen : no such file or directory ]” when i tried to save,how can i fix this?

  16. its not working for me.. when ever i activate it it show error like ” insserv warning script ‘mathkernal’ missing LSB tags and overrides” how can i resolve this erroe .. plz help me ..
    thank you..

  17. its not working for me.. when ever i activate it it show error like ” insserv warning script ‘mathkernal’ missing LSB tags and overrides” how can i resolve this erroe .. plz help me ..
    thank you..

  18. Hi,

    I followed your instructions and it worked out well. I’m booting to the console, which is entered once the video ends. I need to be able to use the standard keyboard commands to control omxplayer however… but they seem to be disabled when omxplayer is run this way. Any idea how I could get that functionality back? The reason is that the only purpose of this raspberry pi is to play a video file(or series of files) in a continuous loop as soon as the unit is powered on, but I’d like to be able to pause/play or skip to the next track with the keyboard.

    Thanks

    • @Fabian Fink

      I had exactly the same problem, turns out that when you copy and paste from
      a browser, even on the pi itself into your text editor of choice (I use gedit) there is an “unseen” character hiding in one of the white spaces. I’m not exactly sure in which
      whitespace it’s hiding but I think somewhere below line 20.

      What I did to fix: Open the file with nano in terminal and manually delete all the spaces and re-insert them with spacebar, and save.

      It’s manual but now it works perfectly!

      I suspect something like notepad++ on a win(fail) machine will sniff out the offending character/s.

      Cheers.
      Lou.

  19. It seems like –loop doesn’t work and so I had to make a video longer than the average boot time, which lead to the video continuing to play while in the background pi is logging in and starting x (startx).

    The solution was to add
    sudo killall -9 omxplayer.bin
    to .bash_profile. Unfortunately the command line becomes visible for a brief moment while x is starting. My solution to that is to delay execution by two seconds:
    sleep 2s && sudo killall -9 omxplayer.bin &

    for some reason, adding this to .xinitrc did nothing though.

  20. what if your /boot/cmdline.txt file is as follows
    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 ro rootfstype=ext4 elevator=noop rootwait vt.global_cursor_default=0 logo.nologo loglevel=1 quiet

    make read-only root, by including ‘ro’ flag. Do you get any error in this configuration.
    because i am trying to run fsck on each boot and my pi run video on boot. I get error with this config

  21. Hey dude,
    I have a rPi B+ with the latest RaspBMC on it with omxplayer_0.3.6~git20141024~98982df_armhf.deb installed and for the life of me I just cannot get it the above tutorial to work. I tried it in windows, then using notepad++ and then ubuntu to try and test if it was the end of line issue with windows vs linux. nada. I tried typing it out manually. Nada. I looks like it is trying to play the file but I just get a black screen then the ‘R’ comes back. Yet when I load RaspBMC up fully and I type omxplayer -p -ohdmi /home/pi/video.mp4 it plays beautifully except the black screen stays and I have to sudo reboot to get my raspBMC back. Without the -o hdmi and it still plays nice but smaller and ‘over’ the Confluence RaspBMC background. This happens with mp4, mov and even the fbi one for jpg and png [http://www.edv-huber.com/index.php/problemloesungen/15-custom-splash-screen-for-raspberry-pi-raspbian]. I’ve googled til my fingers bled so plllease help!! I am tearing my hair out here lol

  22. Hello,

    I followed all steps and my RPI works perfectly with a jpeg image. Thanks.
    But right now I need to replace that picture by a gif. I tried in different ways, but I’m not getting success yet.

    Any suggestion is welcome,

    Thanks,
    Didzan

  23. Pingback: Cutom Splash Screen not working properly in Raspberry Pi B+ | DL-UAT

  24. Hello,

    i modified the boot as I wish but only thing I couldn’t remove so far is the first logo appears with the message for recovery mode hold shift. Do you know where is this logo located or how to remove it.

    Thanks

  25. Hi! I woult like to know what resolution should I use for full screen on all devices like hd ready tv and full hd tv or monitors? I don’t want black bars at all. Thanks!

  26. If you use omxplayer -r -b -o cdmi filename.mp4 it will choose resolution based on video file(-r) regardless of HDMI settings in /boot/config.txt file. -b parameter makes background black/blank.

  27. At least in
    Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux

    in start script you should add dependency from $local_fs like this:
    ### BEGIN INIT INFO
    # Provides: asplashscreen
    # Required-Start: $local_fs
    # Required-Stop:
    # Should-Start:
    # Default-Start: S
    # Default-Stop:
    # Short-Description: Show custom splashscreen
    # Description: Show custom splashscreen
    ### END INIT INFO

    Without this modification omxplayer can’t see local files on boot process

  28. I made a video for my pi3. It works, but the sound goes through HDMI instead of headphones (built a porta pi arcade and using headphone jack for sound)

    I tried adding -o local to the omxplayer command in asplashscreen. I then did
    sudo chmod a+x /etc/init.d/asplashscreen
    sudo insserv /etc/init.d/asplashscreen

    It worked one time and then has never worked again. The video will not even load unless I remove -o local. Then it will load. Very confusing

Leave a Reply

Your email address will not be published. Required fields are marked *