Seamless Video Player using Python on a Raspberry Pi
Le Grille Pain 🍞 (The Toaster) Le Grille Pain 🍞 (The Toaster)
361 subscribers
5,414 views
138

 Published On May 25, 2023

How to play videos with gapless transitions and seamless looping using Python on a Raspberry Pi 4.

A few months ago, a client asked me to build the electronics for an interactive art installation that was looping different videos according to the status of multiple sensors.

What seemed at first like an easy project quickly became a nightmare when the topic of "gapless" playback came into play, which led me to a DEEP DIVE into Raspberry Pi video playback. This video is an overview of the solutions I tried, listing their pros and cons.

GitHub link: https://github.com/iadjedj/lgp_rpi_video

Links and reference :
VLC is the new default player: https://www.raspberrypi.com/news/rasp...
libVLC: https://www.videolan.org/vlc/libvlc.html
The set_media() function, or why VLC isn't gapless: https://github.com/videolan/vlc/blob/...
The issue on VLC's git: https://code.videolan.org/videolan/vl...
Adafruit Pi Video Looper: https://github.com/adafruit/pi_video_...
omxplayer: https://github.com/popcornmix/omxplayer
hello_video : https://projects.raspberrypi.org/en/p...
hello_video code : https://github.com/adafruit/pi_hello_...
RPi forum "All about accelerated video on the Raspberry Pi": https://forums.raspberrypi.com/viewto...
libavcodec: https://en.wikipedia.org/wiki/Libavcodec
Tutorial about openCV VideoCapture :    • Video Data Processing with Python and...  
pydrm: https://github.com/notro/pydrm
Gapless VLC branch : https://code.videolan.org/tguillem/vl... (Take a look at the other branches but this one seems to be the more recent one)

My two StackOverflow best friends:
Storing a video in a numpy array: https://stackoverflow.com/a/42166299
Using the framebuffer with memmap: https://stackoverflow.com/a/58816979

About the modern graphics drivers:
The DRM/KMS subsystem from a newbie’s point of view: https://bootlin.com/pub/conferences/2...
The Modern Linux Graphics Stack on Embedded Systems:    • The Modern Linux Graphics Stack on Em...  

Media sources:
OpenCV AR example:    • openAR: OpenCV Augmented Reality  

Chapters:
00:00 Introduction and project presentation
01:09 libVLC
02:56 What is gapless playback?
04:13 Improving VLC playback
06:29 Adafruit Pi Video Looper
08:35 FFmpeg
10:24 OpenCV
12:22 The Linux framebuffer
14:12 Improving our player
17:00 Other possible improvements
18:08 If you're watching this in the future…
19:05 Conclusion

Oh? You're still reading this?
Then consider leaving a comment about my French accent or about my new animated toasts!

show more

Share/Embed