Saturday, 23 November 2019

The very best way to turn a Raspberry PI into a looping video.


So while waiting for a meeting in a local school, I spotted a redundant TV on the wall.

Sometimes my mind is it's own worse enemy and I started to think about how we could put all of the old videos we've made together on it, using a Raspberry PI. Obviously the start of this is Google. So I got studying.

The simplest and most functional way, wasn't the first way I tried. Surprisingly the current release of Raspbian (Raspberry PI OS) is huge, it almost fills an 8Gb SD card. Although I could have used a USB to store the video files I wanted to have it all on the one device, and I didn't really want to use a bigger SD card. (Like I say, my mind is my own worse enemy).

So I found a command line version of Raspbian and tried a command line player called OMXPLAYER, but I struggled to get it to work initially; which paid off in the long run.

After installing the barebones version of Raspbian (buster-lite) using balenaetcher on Mac. I found I needed a GUI a graphical user interface, so I installed LXDE LX panel which combined only came to ~4.5Gb, plenty of room for the video files. From here I installed VNC and tried to use a few hacks to get that working. But it wouldn't start, and even if it did, I doubt it would do it in full screen mode.

So I re-wound and went back to looking at command line prompts and this is where the magic happened. Editing the RC.local file (which starts on boot up) allowed me to add the line

omxplayer --loop /home/pi/video.m4v

(video m4v was a special big edit of all of the videos, with splash screens of the school name in between).

And that was it, on boot, the video played and looped indefinitely, BUT in the background, the OS was also booting. By this stage I'd already installed Real VNC, but logging in again I could see the OS. But amazingly the video on the main display was still showing the loop. I actually couldn't get it to stop.

What does this mean?

In the real world. The users can boot their TV and the PI will play in the normal way. Remotely, this will enable me to to edit the master, transfer the master to the device (this is what I am testing now) replace the original file and reboot to start playing the new file.

I'd accidentally stumbled across the most perfect solution.

Now I have to manually add the SSID for the school network, so hopefully it will connect, without being able to access the GUI, then it should work exactly the way I want it to, forever.




Simple laptop buying advice.