The Raspberry Pi comes with an awesome little video player called OMXPlayer that is very capable of playing back full 1080p video perfectly when encoded correctly in H.264/AAC.
OMXPlayer is a commandline OMX player for the Raspberry Pi. It was developed as a testbed for the XBMC/Kodi Raspberry Pi implementation and is quite handy to use standalone.
One problem is the current lack of playlist support in omxplayer. This post explains how to create a bash script that will permanently loop through and play a directory of videos.
To install the Omxplayer on Raspbian
sudo apt-get install omxplayer
Playing a movie with OMXPlayer
Here is a list of all the omxplayer options and a general how to use them.
[email protected]:~$ omxplayer --help Usage: omxplayer [OPTIONS] [FILE] Options : -h / --help print this help -a / --alang language audio language : e.g. ger -n / --aidx index audio stream index : e.g. 1 -o / --adev device audio out device : e.g. hdmi/local -i / --info dump stream format and exit -s / --stats pts and buffer stats -p / --passthrough audio passthrough -d / --deinterlace deinterlacing -w / --hw hw audio decoding -3 / --3d switch tv into 3d mode -y / --hdmiclocksync adjust display refresh rate to match video -t / --sid index show subtitle with index -r / --refresh adjust framerate/resolution to video
HDMI cable for video output and standard 3.5 mm for audio output:
omxplayer -o local /VideoFileLocation/VideoFileName.videoextension
Send audio through the HDMI cable with video:
omxplayer -o hdmi /VideoFileLocation/VideoFileName.videoextension
Create script for looping video playlist
Create the following script and save a name e.g. “videoloop.sh”
#!/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="/mnt/storage/videos" # you can normally leave this alone SERVICE="omxplayer" # now for our infinite loop! while true; do if ps ax | grep -v grep | grep $SERVICE > /dev/null then sleep 1; else for entry in $VIDEOPATH/* do clear # -r for stretched over the entire screen omxplayer -r $entry > /dev/null done fi done
Save the script and make it executable
sudo chmod +x videoloop.sh
Then run it as follows
./videoloop.sh
Obviously this is fairly basic; just loops through a directory of videos and plays them one after another.