Use a Raspberry Pi as a Looping Video Player

If you want a video to loop on a HD screen in your art installation, shop window or on your trade show stand, there is a simple way to do it with a standard Raspberry Pi.

In this article we will show you how you can turn your Raspbery Pi into a looping video player.

There was a time when if you wanted a video to loop, you had to make a copy of the video multiple times to fill up whatever playback medium you had, such as a VHS cassette or more recently a DVD or Blu Ray.

video-looper-vhs

But when the loops ran out after about an hour or so, you had to either rewind or press Play again, and that was only if you noticed it. If you were at a trade show and had a video monitor behind you, you might have noticed that the sound stopped. If there was no sound, you had to check every once in a while to see if it was still going.

There has to be a better way of doing it, right? Sure enough there is. Tim Schwartz has built a Video Looper based on a Linux program called Omxplayer. (For more details on OMXplayer and configuring and controlling it, see this link.)

You can set up a Raspberry Pi and an HDMI monitor and put in an SD card, and it’ll play the video over and over until either the power goes off or you stop it.

Getting an image of Video Looper is easy; just go here and get the image. Burn it to an SD card with your favorite SD burner and you’re good to go.

video-looper-tim-schwartz

As always with the Pi, the hard part is getting the data onto the SD card. To get videos into the looper software, you have to access the Linux partition of the card which is inadvisable any other way than the following.

1. Boot the Pi with a Raspbian image so what you have is basically a little Linux computer. Then using an SD card adapter and a USB hub, copy the video file or files you want to loop into the target directory.

In this case the directory you are looking for is

/home/pi/video

Note: more details of how to do this common file transfer task are included in a previous article on Turning Your Pi Into A Retro Game Console.

Videos must be in MP4 format. If you want to get fancy and run DVD or MPEG-2 files directly in the looper, then you will need a license to play them which you can obtain here for a few bucks.

To start the video lopping, all you have to do is boot the Pi, and the video starts automatically. Hitting Escape on a keyboard (if you have one plugged in) will quit out of the Video Looper and drop you back to the command line.

If you have an original model A or a B, then Video Looper will work perfectly. There have been some reports of problems with Pi2 and A+ and B+. If you have a newer model of Pi, make sure you use an up-to-date Raspbian image or do an update. To do this in a terminal command line on the video looper disk, type

sudo apt-get update
sudo apt-get upgrade

and all should be well. And while you are there, you should also expand the root partition to make room for your videos. You may have to modify the startup file at

/home/pi/startvideo.sh

to stop the autoboot of the video. Don’t forget to change it back to autobooting before you run your video loop.

Also, some users have reported problems with the video playing once and dropping out. The problem seems to be spaces in the filename of the video. To be sure, take care to not add spaces in your filename or insert “_” instead.

It’s possible you might want to make sound come out of something other than the default, e.g. the speakers in your HDMI monitor. If the monitor has a headphone socket, you can run the audio out of that into a device with an amplifier and speakers.

But the best way to do it if you really must is to add a DAC to the system and run the sound out of that. Little USB audio cards like this one are available from many suppliers, but make sure it’s suitable for RasPi before you commit.

And finally, it goes without saying that if you are running this system in a sales environment where you can’t break off to fix any problems, to make a few duplicates of your SD card once it’s configured and running properly. If for any reason the main card gets corrupted, you can switch it out, turn everything back on and get the video running again.

Have you had some experiences looping video with the RasPi? Are there any other applications for the Pi you wish you had? Let us know in the comments below.

Image Credit: Buster Baxter