Difference between revisions of "Setting up a raspberry pi 3 as a kiosk video player"
Line 15: | Line 15: | ||
And put in the following information | And put in the following information | ||
− | <nowiki> | + | <nowiki>#</nowiki>!/bin/bash |
− | #!/bin/bash | + | |
− | for i in `seq 1 $1` | + | for i in `seq 1 $1` |
− | do | + | |
+ | do | ||
for file in /video/*.mp4 | for file in /video/*.mp4 | ||
+ | |||
do | do | ||
/usr/bin/omxplayer -o both -b $file | /usr/bin/omxplayer -o both -b $file | ||
done | done | ||
− | |||
− | cat /home/pi/log #show contents | + | done |
− | rm -f /home/pi/log #then empty | + | |
− | touch /home/pi/log | + | |
+ | cat /home/pi/log #show contents | ||
+ | |||
+ | rm -f /home/pi/log #then empty | ||
+ | |||
+ | touch /home/pi/log | ||
+ | |||
+ | <nowiki>#</nowiki>if doing this often, check the file system is good then shutdown | ||
+ | |||
+ | if [ $1 -gt 5 ] | ||
+ | |||
+ | then | ||
− | |||
− | |||
− | |||
sudo /home/pi/fd | sudo /home/pi/fd | ||
+ | |||
sudo /sbin/shutdown -h now | sudo /sbin/shutdown -h now | ||
− | + | ||
− | + | fi | |
You can then put as many videos in /video as you wish to cycle! | You can then put as many videos in /video as you wish to cycle! |
Latest revision as of 20:02, 10 July 2023
On your raspberry pi 3 update and upgrade:
> sudo -i
> apt update
> apt upgrade
> apt install omxplayer
Then make a script:
> vi /home/pi/play.sh
And put in the following information
#!/bin/bash
for i in `seq 1 $1`
do for file in /video/*.mp4
do /usr/bin/omxplayer -o both -b $file done
done
cat /home/pi/log #show contents
rm -f /home/pi/log #then empty
touch /home/pi/log
#if doing this often, check the file system is good then shutdown
if [ $1 -gt 5 ]
then
sudo /home/pi/fd
sudo /sbin/shutdown -h now
fi
You can then put as many videos in /video as you wish to cycle!
On an older raspberry pi 3
Edit the /boot/cmdline.txt to be:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty3 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait logo.nologo loglevel=3 vt.global_cursor_default=0
NB This must all be on the same line!
Then
> echo "/home/pi/play.sh 120" >> /etc/rc.local
On the latest raspberry pi 3
Edit the /boot/cmdline.txt to be:
consoleblank=1 logo.nologo quiet loglevel=0 plymouth.enable=0 vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fastboot noatime nodiratime noram
NB This must all be on the same line!
In /boot/config.txt uncomment or add:
disable_splash=1
Then echo "/home/pi/play.sh 120" >> /home/pi/.bashrc