RPiLooper v2 (seamless video looper) step-by-step instructions

In an earlier post (available here), we shared a downloadable image for RPiLooper, which added functionality and made it much easier to get up and running with minimal effort, provided your needs are as narrow as ours 😉

Because some have asked for the step by step instructions, and we fortunately recorded just what it was we did, we’re sharing our log below.


The first version played videos directly from the SD card, which worked as intended. However, it was difficult to change the video that was playing, and also made the replication process a little difficult. We need a good 10-12 of these running, each with a different video loop, so our preference is to get one Pi functioning just how we need, pull the image off the SD card, and push an identical image onto 10-12 new cards with minimal (or zero) modifications. By auto-mounting a usb drive on boot and pointing our player at the new location, we achieved that goal.

Step 1 – Install Raspbian

Start with the Raspbian distro from the raspberrypi.org downloads page: http://downloads.raspberrypi.org/raspbian_latest

Raspbian setup instructions:

To use an image file, you will need to unzip it and write it to a suitable (2GB or larger, 4GB or larger for Raspbian) SD card using the UNIX tool dd. Windows users should use Win32DiskImager. Do not try to drag and drop or otherwise copy over the image without using dd or Win32DiskImager – it won’t work. If you’re still not clear on what to do, the community on the Raspberry Pi Wiki has written a guide for beginners on how to set up your SD card.

Go ahead and boot up your fresh Raspbian install. Make sure to connect a network cable to your DHCP enabled network, along with a monitor, mouse, and keyboard prior to booting. You’ll get a configuration screen the first time which will let you change the password and make some other changes.


You can expand the filesystem if you want, but we’ll be loading our video onto an external drive.

Do the Change User Password thing too. Remember, you’re changing the password for the “pi” user here.

Hit Finish, and when it asks if you want to reboot, hit Yes.

Once you’re booted up, go ahead and run ifconfig and record the ip address (which you’ll have only if you’ve connected your raspberry pi to a network with a DHCP server). You will want to know this later to SSH in to your pi to make changes, if necessary.

Step 2 – Rebuild hello_pi code examples

Navigate to the /opt/vc/src/hello_pi directory and run the rebuild.sh script as follows:

cd /opt/vc/src/hello_pi/

sudo ./rebuild.sh

Step 3 – Update hello_video.bin

Update the hello_video source code to loop any video played with hello_video.bin:

cd /opt/vc/src/hello_pi/hello_video/

sudo pico video.c

Scroll down to around line 120, and look for the following lines of code:



Replace the above with this:


fseek(in, 0, SEEK_SET);

Note that correct capitalization is important. Use Ctrl+O to save, and Ctrl+X to exit.

Now, while still in the /opt/vc/src/hello_pi/hello_video/ directory, use the make command to compile the code:

sudo make

Step 4 – Mount USB drive

Go ahead and load a video on a USB drive, using another computer. The drive should be formatted in fat32, and only .h264 or .m4v video files will work with this solution. As with others in the thread referenced above, I suggest using Yamb to rip the video out of the container. Once finished with Yamb, you will have a file with an .h264 or .m4v suffix. Let’s say this video of yours is called testvideo.h264.

Insert your USB thumb drive, and check your /dev folder to see where it shows up. Mine was at /dev/sda1.  Oh, make sure you have only one USB drive inserted.

cd /dev


You’ll probably see entries for sda and sda1. You may instead see sba and sba1 (I observed that on one raspbian build I was testing).

Create a folder to which your USB drive will be mounted, and then proceed with the mount.
*****(FYI – depending on your version of Raspbian, you may need to replace all references of /dev/sda1 to /dev/sha1 – if you’re having difficulty mounting the USB drive, give this a try!)*****

cd /mnt

sudo mkdir usb

sudo mount /dev/sda1 /mnt/usb

Go ahead and make sure this worked.

cd /mnt/usb


You should see the files on your USB drive listed. If so, you’re good!

Now let’s make this drive mount to /mnt/usb every time we boot:

sudo pico /etc/fstab

Add the following at the end:

/dev/sda1 /mnt/usb vfat defaults 0 0

Ctrl + O to save, Ctrl + X to exit.

If you ran into trouble here, refer to these instructions: http://kwilson.me.uk/blog/force-your-raspberry-pi-to-mount-an-external-usb-drive-every-time-it-starts-up/

Step 5 – Play a test video

Now try playing your video with your updated hello_video code:

cd /opt/vc/src/hello_pi/hello_video/

./hello_video.bin /mnt/usb/testvideo.h264

You should see your video, and it should loop seamlessly. A shorter video is going to be easier to test with, unless you want to sit through a movie to test it.

You can kill the process with Ctrl+C.

Step 6 – Start the video loop on boot

This bit starts the video loop on boot, before the login screen.

Create a file called seamless_video.sh in etc/init.d, and open it:

cd /etc/init.d/

sudo pico seamless_video.sh

Type in or paste the following:

#! /bin/sh

# /etc/init.d/seamless_video

#echo “nstart”

cd /opt/vc/src/hello_pi/hello_video/

./hello_video.bin /mnt/usb/*

echo “donen”

exit 1

Save and close the file with Ctrl+O and then Ctrl+X.

Change the permissions on your seamless_video.sh script to allow it to be executed, and add symbolic links to force it to start when the system boots:

sudo chmod 755 seamless_video.sh

sudo update-rc.d seamless_video.sh defaults

This will play the first video (sorted alphabetically) in the root of your USB thumb drive that is in .h264 or .m4v format. Also, there is no way to stop the loop once it starts. Rebooting the Pi with no thumb drive inserted, or with a thumb drive containing no videos will bring you to a normal login screen.

If you try testing at this stage by rebooting, you’ll end up with any bootup messages showing up in the “black bars” of the video, if it doesn’t completely fill the screen. So, we’ll want to hide those messages.

Step 7 – Hide boot messages on screen

Edit the /boot/cmdline.txt file:

sudo pico /boot/cmdline.txt

Make these changes:

– Replace “console=tty1” with “console=tty3” to redirect boot messages to the third console.

– Add logo.nologo to remove Raspberry Pi logo

– Add “loglevel=3” to disable non-critical kernel log messages.

– Add “vt.global_cursor_default=0” to disable the blinking cursor.

Here’s an example /boot.cmdline.txt file:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty3 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait logo.nologo loglevel=3 vt.global_cursor_default=0


That’s it – reboot your Pi and you should have a fullscreen, seamlessly looping video! Just replace the video on your thumb drive to change your loop.


Video demo of seamless transition: https://www.youtube.com/watch?v=owwmkfBxZpg 

Here’s a converted video file you can use to test your system: https://dl.dropboxusercontent.com/u/10245008/RPiLooper/Coffee-53s-slomo.h264