Stian Remvik Datagrafikk

Seamless looping video with audio using openFrameworks

Using ofxOMXplayer in openFrameworks works great with seamless looping and audio. I used H264 codec with Apple Compressor, but ofxOMXPlayer github site recommends MPEGStreamclip H264 and PCM Audio (more compatible with HDMI). I am using a SanDisk Extreme microSDHC UHS-I card with speeds up to 90 MB/s and Raspberry Pi 2. I think using a fast SD card is essential.

Memory split

Set to min 128. Maybe 256 or 512 is better.

$ sudo raspi-config

Go to advanced.


You may have to this to enable sound over headphone jack:

$ sudo modprobe snd_bcm2835
$ sudo amixer cset numid=3 1

To use HDMI Audio you may need to add the below line to /boot/config.txt and reboot. See for more details


Auto-mount USB-stick

USB auto-mount

Make sure the USB-stick ONLY contains video files(s) and no directories.

Why no ALSA (HiFi-Berry in my case)

Not really possible. The clock, video_decode, video_schedule, video_render, audio_decode, audio_mixer, audio_render are tunnelled components that all run on the GPU. audio_render can only output to GPU controlled audio (i.e. hdmi or analogue headphone socket). To output audio to ALSA you would want a completely different architecture. Something very like VLC (which can support GPU video acceleration), which handles the clock scheduling and audio paths on the ARM. Kodi is another option that supports ALSA.

Daemontools supervise

Daemontools supervise makes sure your program is always running. E.g. if you accidentaly quit your openFrameworks program with ‘esc’ key, it will automatically restart your program.

Auto-start program on boot

Hide boot log

My /boot/cmdline.txt file looks like this:

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

Hide login

setterm -blank force in /home/pi/.bashrc and NO SLEEP in crontab.

"BITWaves" iOS app
Raspberry Pi Notes
"Neighbours" video installation
Electronic Vintage Bit20 concert visuals
"Late into that night, and all the following nights" installation
"Bergen Leser" installation
"Cubes" animation
NRK3 identity film
"Hush!" installation
"The sound of pictures" installation
Concert visuals Knekklectic
Hulen Bergen posters and design
Notes on programming and other technical difficulties

Multi screen video with Multiscreener on Mac
Seamless looping video player on Raspberry Pi using openFrameworks