1

I'd like to use my raspberry pi3 to automatically show some videos or pictures in a folder after boot. At the current state, even only pictures are ok, even if I'd like to have both.

For pictures I found fbi, and it works if I launch it manually. I am not able to make it run at startup.

This is the script I added in /etc/init.d/:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:      
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Show custom splashscreen
# Description:       Show custom splashscreen
### END INIT INFO


do_start () {

    /usr/bin/fbi -d /dev/fb0  -T 1 -noverbose -a -t 5 /home/pi/Photos/*.jpg &    
    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

which I simply copied and modified the actual command. I then add it to the run level with sudo update-rc.d myscript defaults.

Now, the problem is that the images start play just before the login prompt is shown and after some seconds they get interrupted (in correspondence of the end of the boot process).

If the picture part works, I can try to move forward and add also videos (but in this second case I have other problems)

Thanks for the help.

EDIT: If I try to show only videos with omxplayer with the following script

#!/bin/sh

# get rid of the cursor so we don't see it when videos are running
setterm -cursor off

# set here the path to the directory containing your videos
VIDEOPATH="/home/pi/Videos" 

# you can normally leave this alone
VIDEOSERVICE="omxplayer"

# now for our infinite loop!
while true; do
        if ps ax | grep -v grep | grep $VIDEOSERVICE > /dev/null
        then
            sleep 1;
        else
            for entry in `find ${VIDEOPATH} -type f`; do
            clear
                    # forcing output to local to avoid sounds: -o local
                    omxplayer -r -b "$entry" > /dev/null
        done
    fi
done

(called in /etc/rc.local) it works, so it is probably something related to fbi

2 Answers 2

2

Try editing the /etc/rc.local file like so

... # other initialization

/usr/bin/fbi -d /dev/fb0  -T 1 -noverbose -a -t 5 /home/pi/Photos/*.jpg &

exit 0

Also might need to disable boot to X in raspi-config

If you are looking to create a digitial signage solution, there are other options as well such as minibian which I personally prefer; or some others

2
  • Unfortunately the problem is the same. When launched at boot only the first couple of images are displayed, and then the prompt is shown. If instead after the boot I login and manually launch the script (sudo /etc/init.d/rc.local start) it correctly works. So it seems to be a boot issue (which I did not have on the old PI1)
    – Francesco
    Commented Sep 28, 2016 at 15:41
  • I've just tried with only videos and it works (see edit in my question). So, it seems a problem of fbi..
    – Francesco
    Commented Sep 28, 2016 at 15:56
0

Add a sleep command in a script executed in background in rc.local to cause fbi to wait to execute until after login prompt displays

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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