All Projects → kalanda → RPi-MediaLooper

kalanda / RPi-MediaLooper

Licence: other
Automatic video or audio loop for digital posters and audiovisual installations using Raspberry Pi hardware

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to RPi-MediaLooper

Bootstrap
Tools to bootstrap micro computers
Stars: ✭ 55 (+129.17%)
Mutual labels:  raspbian, sd-card
pi-factory
Bootstrap a bitcoin lightning box for Raspberry Pi 3 based on Alpine Linux
Stars: ✭ 17 (-29.17%)
Mutual labels:  sd-card
animate
👾 Create and manage animation functions with AnimationFrame API.
Stars: ✭ 11 (-54.17%)
Mutual labels:  loop
raspberrypi-rstudio
RStudio for Raspberry Pi - Docker Build and Runtime Environment
Stars: ✭ 57 (+137.5%)
Mutual labels:  raspbian
goone
goone finds N+1 query in go
Stars: ✭ 41 (+70.83%)
Mutual labels:  loop
build-raspbian-image
Builds a minimal Raspbian Stretch image
Stars: ✭ 40 (+66.67%)
Mutual labels:  raspbian
ansible-role-raspberry-pi
Configures a Raspberry Pi (running Raspbian).
Stars: ✭ 90 (+275%)
Mutual labels:  raspbian
epdtext
A simple display manager app for the WaveShare 2.7in e-Paper Display
Stars: ✭ 18 (-25%)
Mutual labels:  raspbian
videojs-abloop
A video.js plugin for looping of a section of video, with GUI and API controls
Stars: ✭ 36 (+50%)
Mutual labels:  loop
react-for
A React component library to create loops in JSX
Stars: ✭ 22 (-8.33%)
Mutual labels:  loop
SRLCD
fast loop closure detection (online visual place recognition) via saliency re-identification IROS 2020
Stars: ✭ 78 (+225%)
Mutual labels:  loop
balena-chromium-kiosk
BalenaOS/BalenaCloud based Kiosk using Chromium on a RaspberryPi
Stars: ✭ 46 (+91.67%)
Mutual labels:  raspbian
DSAC
DockSTARTer App Config helps you configure some of your Docker apps!
Stars: ✭ 20 (-16.67%)
Mutual labels:  raspbian
TimerInterrupt
This library enables you to use Interrupt from Hardware Timers on an Arduino, such as Nano, UNO, Mega, etc. It now supports 16 ISR-based timers, while consuming only 1 hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based timers. Therefore, their executions are not blocked by bad-behavin…
Stars: ✭ 76 (+216.67%)
Mutual labels:  loop
staticstep
Provides truly zero-cost alternatives to Iterator::step_by for both incrementing and decrementing any type that satisfies RangeBounds<T: Copy + Default + Step>.
Stars: ✭ 13 (-45.83%)
Mutual labels:  loop
scarecrow
A Raspberry Pi powered, distributed (edge) computing camera setups that runs a Tensorflow object detection model to determine whether a person is on the camera. A plugin model allows actions based on the detection, such as playing audio, turning on lights, or triggering an Arduino.
Stars: ✭ 87 (+262.5%)
Mutual labels:  raspbian
wor-flasher
Legal utility that runs on RPiOS to flash another SD card with Windows 10/11
Stars: ✭ 451 (+1779.17%)
Mutual labels:  raspbian
raspberrypi-ptp
How to run IEEE-1588 on RaspberryPi hardware
Stars: ✭ 57 (+137.5%)
Mutual labels:  raspbian
edi-raspbian
edi configuration for emulated raspbian and raspbian cross compilation.
Stars: ✭ 16 (-33.33%)
Mutual labels:  raspbian
PiBeacon
Low-cost iBeacon using Raspberry Pi
Stars: ✭ 41 (+70.83%)
Mutual labels:  raspbian

RPi-MediaLooper

Automatic looper for video or audio useful for digital posters and audiovisual installations using Raspberry Pi hardware.

  • Looks for files stored in a USB device
  • Recognized file extensions .mp4, .avi, .mkv, .mp3, .mov, .mpg, .flv, .m4v and .divx
  • Audio output is set by default to HDMI but is configurable via config.txt file placed on USB root
  • Automatic startup without user intervention when device is powered on
  • If more than one file is found will play all in alphabet order and start again

Overview

This project is based in only one script that runs on a Raspbian installation. The script will check all files inside the storage device connected to USB port (mounted at /media/usb) and make calls to omxplayer to play each supported file in a endless loop (you can press CTRL-C to cancel).

Code and ideas are taken from other projects listed below at the end of this document.

Installation instructions

For the installation you need:

  • SD Card 4 Gb or more
  • USB storage device like a pendrive or a portable hard disk.
  • USB keyboard (only during installation)
  • Ethernet cable for internet access using your local network (only during installation)

Step 1. Install Raspbian.

Download the lastest version of Raspbian and install following the installation instructions to create your SD card with the Raspbian system.

Step 2. Expand filesystem

First time you boot the fresh Raspbian installation, the raspi-config menu will appear and you must choose "Expand filesystem" to make usable all the free space in SD card. There are some other options you can change here but are not required for this project.

NOTE: You can always open this utility again by typing sudo raspi-config at command line

Step 3. Fix locale warnings

Some warnings referring to locale appears when installing some packages. To fix this you have to edit /etc/default/locale file:

sudo nano /etc/default/locale

Put that:

LANG=en_GB.UTF-8
LC_ALL=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8

When is done, press CTRL-O and ENTER to save and CTRL-X to exit.

Step 4. Update and upgrade packages

First at all, you have to update and upgrade packages:

sudo apt-get update
sudo apt-get upgrade

Step 5. Install USB automount

This makes your USB storage easiest to mount at boot and any time you disconnect and connect again.

sudo apt-get install usbmount

Step 6. Download our script

Download the script:

cd /home/pi
wget https://raw.githubusercontent.com/kalanda/RPi-MediaLooper/master/videoloop.sh

Add permissions to execute:

chmod +x videoloop.sh

Step 7. Test the script

Put a video or audio file in a USB storage device and connect it to Raspberry Pi, then write this at your prompt:

./videoloop.sh

This should play your video in a endless loop. Press CTRL-C anytime to exit.

Step 8. Configure autologin without password

Our system is not necessary connected to a keyboard to work and has not any sensible data, then autologin is not a problem and makes easy to run our script at startup.

Edit /etc/inittab

sudo nano /etc/inittab

Disable the getty program by adding # to comment this line:

#1:2345:respawn:/sbin/getty 115200 tty1

Add login program to inittab adding the following line just below the commented line

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

This will run the login program with pi user and without any authentication.

When is done, press CTRL-O and ENTER to save and CTRL-X to exit.

Step 9. Add script to startup

To run at startup, edit /etc/profile by typing:

sudo nano /etc/profile

Add /home/pi/videoloop.sh at the end of file

When is done, press CTRL-O and enter to save and CTRL-X to exit.

Now you can reboot your system to test:

sudo reboot

Script will start automatically when systems reboots.

Prevent SD card from getting corrupted

If your system will be placed in a environment where shutdown is done by switching power supply, the SD card can get corrupted easily if shutdown occurs while system is writing data. To prevent this situation is possible to mount all partitions with readonly flag and put logs and pids at RAM memory (erased at shutdown).

Edit /etc/fstab by typing:

sudo nano /etc/fstab

Put ro (readonly) to defaults column of all partitions and add last two lines to mount logs an run in RAM. It should look something like the following.

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    ro                0       2
/dev/mmcblk0p2  /               ext4    ro                0       1
none            /var/run  ramfs   size=1M  0 0
none            /var/log  ramfs   size=1M  0 0

When is done, press CTRL-O and ENTER to save and CTRL-X to exit. Then run:

sudo partprobe 

This alert system to recognize the new partition. Now you can reboot your system to test

sudo reboot

If for some reason you need to make changes to your system, you can remount the read-only partitions with write access:

sudo mount -o remount,rw /dev/mmcblk0p2

Inspiration projects

Finding a good solution for showing a single video throught projectors in a infinite loop using Raspberry Pi as hardware. I found some interesting projects on Internet but, each one with their pros and cons. I learn a lot testing those but I decided to take the best of all and make my custom project based on my needs.

CuriousTechnologist's solution - link

PROS: Real seamless loop, no blanks or gaps between loops.

CONS: Does not support audio. Is based on a custom binary program coded in C. Requires to prepare videos with a specific feature of h264 codec using AviDemux and naming the file with .h264 extension to work.

StevenHickson's solution - link

PROS: Code is available at GitHub. Is based on omxplayer, which can play almost any video format. Creates a service daemon to autoboot.

CONS: The loop is not seamless, the gap between loops (1 or 2 seconds) depends of the length of video. If you don't use the disk image, the code has some bugs on the installer and the code because uses a standalone version of omxplayer instead the version included by default in Raspbian. When omxplayer plays your videos, uses the -l option for loop, but there are some bugs on this feature. If video has not audio, it hangs on second loop. If video is in a mp4 container, 5 seconds at the end of video will lost in each loop (issue 291).

GeekTips's solution - link

PROS: Just one bash script. Uses the omxplayer that comes with Raspbian that is IMO, the best option to play any video, but instead of -l option for loop (this option has some bugs commented above) the script calls in a infinite while loop to omxplayer for launch the video. Catch for CTRL-C to stop the player.

CONS: Has not online repository for code. Don't provides a autoboot feature.

Other similar projects

Useful links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].