Posted on 4 Comments

OMXPlayer Series Play

This is a little script to make OMXPlayer on the Raspberry Pi cycle through every file in a specified folder, useful for playing sequential movies or series of episodes.


if [ x"$1" = x"help" -o x"$1" = x"--help" -o x"$1" = x"-help" ];then
 echo "Usage: omxseries  [folder path]"
 echo "Audio Mode can be either 'hdmi' or 'local'."
 echo "Folder Path is the full path to the video files on your system."
 echo "This script will attempt to play every file in the target folder, with any file extension,"
 echo "so ensure that only valid video files are present in the target folder to avoid errors."
for file in $2/*
 omxplayer -o $1 $file

[root@raspbian ~]# omxseries hdmi /media/stuff/videos
would play everything in /media/stuff/videos and send the audio over the HDMI port.

Download the script to your Pi with this code:

wget -O /usr/bin/playseries && chmod +x /usr/bin/playseries

4 thoughts on “OMXPlayer Series Play

  1. Hello, and thx, this is just what i needed, can you tell me what i can add to the script so it would loop.

    i need it to start over when its done playing all files in the folder.

    1. while true
      for file in $2/*
      omxplayer -o $1 $file

      That should work, I have simply put the original code into a continuous loop.

      1. Thx that works! 🙂

        it might be me who is tired, but i cannot seem to find any list on which videofiles the omxplayer supports. atm i now it works with mp4 and mkv, and dont work with wmv.

        1. Those are merely file extensions – it will play anything as long as it’s encoded with H.264, as the Raspberry Pi only supports that codec for hardware acceleration.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.