{"id":19133161,"url":"https://github.com/kalanda/rpi-medialooper","last_synced_at":"2025-05-06T18:49:57.988Z","repository":{"id":27622626,"uuid":"31106758","full_name":"kalanda/RPi-MediaLooper","owner":"kalanda","description":"Automatic video or audio loop for digital posters and audiovisual installations using Raspberry Pi hardware","archived":false,"fork":false,"pushed_at":"2015-02-21T15:55:17.000Z","size":124,"stargazers_count":27,"open_issues_count":0,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-19T13:44:50.697Z","etag":null,"topics":["loop","raspberry-pi","raspbian","sd-card","video"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kalanda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-21T02:08:37.000Z","updated_at":"2023-11-27T11:17:38.000Z","dependencies_parsed_at":"2022-07-24T15:16:52.169Z","dependency_job_id":null,"html_url":"https://github.com/kalanda/RPi-MediaLooper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalanda%2FRPi-MediaLooper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalanda%2FRPi-MediaLooper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalanda%2FRPi-MediaLooper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalanda%2FRPi-MediaLooper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kalanda","download_url":"https://codeload.github.com/kalanda/RPi-MediaLooper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252750233,"owners_count":21798676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["loop","raspberry-pi","raspbian","sd-card","video"],"created_at":"2024-11-09T06:21:16.204Z","updated_at":"2025-05-06T18:49:57.963Z","avatar_url":"https://github.com/kalanda.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"RPi-MediaLooper\n===============\nAutomatic looper for video or audio useful for digital posters and audiovisual installations using *Raspberry Pi* hardware. \n\n- Looks for files stored in a USB device\n- Recognized file extensions .mp4, .avi, .mkv, .mp3, .mov, .mpg, .flv, .m4v and .divx\n- Audio output is set by default to HDMI but is configurable via *config.txt* file placed on USB root\n- Automatic startup without user intervention when device is powered on\n- If more than one file is found will play all in alphabet order and start again\n\n## Overview\n\nThis 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). \n\nCode and ideas are taken from other projects listed below at the end of this document. \n\n## Installation instructions\n\nFor the installation you need:\n\n- SD Card 4 Gb or more\n- USB storage device like a pendrive or a portable hard disk.\n- USB keyboard (only during installation) \n- Ethernet cable for internet access using your local network (only during installation)\n\n### Step 1. Install Raspbian. \n\n[Download](http://www.raspberrypi.org/downloads/) the lastest version of Raspbian and install following the [installation instructions](http://www.raspberrypi.org/documentation/installation/installing-images/README.md\n) to create your SD card with the Raspbian system.\n\n### Step 2. Expand filesystem\nFirst 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. \n\n**NOTE:** You can always open this utility again by typing `sudo raspi-config` at command line\n\n### Step 3. Fix locale warnings\nSome warnings referring to locale appears when installing some packages. To fix this you have to edit `/etc/default/locale` file:\n\n\tsudo nano /etc/default/locale\n\nPut that:\n\n\tLANG=en_GB.UTF-8\n\tLC_ALL=en_GB.UTF-8\n\tLANGUAGE=en_GB.UTF-8\n\t\nWhen is done, press CTRL-O and ENTER to save and CTRL-X to exit.\n\n### Step 4. Update and upgrade packages\nFirst at all, you have to update and upgrade packages:\n\n\tsudo apt-get update\n\tsudo apt-get upgrade\n\t\n### Step 5. Install USB automount\nThis makes your USB storage easiest to mount at boot and any time you disconnect and connect again.\n\n\tsudo apt-get install usbmount\n\n### Step 6. Download our script\n\nDownload the script:\n\n\tcd /home/pi\n\twget https://raw.githubusercontent.com/kalanda/RPi-MediaLooper/master/videoloop.sh\n\nAdd permissions to execute:\n\n\tchmod +x videoloop.sh\n\t\n### Step 7. Test the script\n\nPut a video or audio file in a USB storage device and connect it to *Raspberry Pi*, then write this at your prompt:\n\n\t./videoloop.sh\n\t\nThis should play your video in a endless loop. Press CTRL-C anytime to exit.\n\t\n### Step 8. Configure autologin without password\nOur 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.\n\nEdit `/etc/inittab`\n\n\tsudo nano /etc/inittab\n\nDisable the getty program by adding `#` to comment this line:\n\n\t#1:2345:respawn:/sbin/getty 115200 tty1\n\nAdd login program to inittab adding the following line just below the commented line\n\t\n\t1:2345:respawn:/bin/login -f pi tty1 \u003c/dev/tty1 \u003e/dev/tty1 2\u003e\u00261\n\nThis will run the login program with *pi* user and without any authentication.\n\nWhen is done, press CTRL-O and ENTER to save and CTRL-X to exit.\n\n### Step 9. Add script to startup\t\nTo run at startup, edit `/etc/profile` by typing:\n\n\tsudo nano /etc/profile\n\t\nAdd `/home/pi/videoloop.sh` at the end of file\n\nWhen is done, press CTRL-O and enter to save and CTRL-X to exit.\n\nNow you can reboot your system to test:\n\n\tsudo reboot\n\t\nScript will start automatically when systems reboots.\n\t\n## \tPrevent SD card from getting corrupted\n\nIf 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). \n\nEdit `/etc/fstab` by typing:\n\n\tsudo nano /etc/fstab\n\nPut `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. \n\n\tproc            /proc           proc    defaults          0       0\n\t/dev/mmcblk0p1  /boot           vfat    ro                0       2\n\t/dev/mmcblk0p2  /               ext4    ro                0       1\n\tnone            /var/run  ramfs   size=1M  0 0\n\tnone            /var/log  ramfs   size=1M  0 0\n\t\nWhen is done, press CTRL-O and ENTER to save and CTRL-X to exit. Then run: \n\n\tsudo partprobe \n\t\nThis alert system to recognize the new partition. Now you can reboot your system to test\n\n\tsudo reboot\n\t\nIf for some reason you need to make changes to your system, you can remount the read-only partitions with write access:\n\n\tsudo mount -o remount,rw /dev/mmcblk0p2\n\n\n## Inspiration projects\n\nFinding 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.\n\n#### CuriousTechnologist's solution - [link](http://curioustechnologist.com/post/104242571716/rpilooper-v2-b-seamless-video-looper-for)\n**PROS:** Real seamless loop, no blanks or gaps between loops. \n\n**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.\n\n#### StevenHickson's solution - [link](http://stevenhickson.blogspot.com.es/2014/05/rpi-video-looper-20.html)\n\n**PROS:** Code is available at [GitHub](https://github.com/StevenHickson/RPiVideoLooper). Is based on *omxplayer*, which can play almost any video format. Creates a service daemon to autoboot.\n\n**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](https://github.com/popcornmix/omxplayer/issues/291)). \n\n#### GeekTips's solution - [link](http://www.geek-tips.com/2014/07/30/infinite-video-loops-on-a-raspberry-pi/)\n\n**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.\n\n**CONS:** Has not online repository for code. Don't provides a autoboot feature. \n\n#### Other similar projects\n\n- [https://github.com/kimaernoudt/videolooper](https://github.com/kimaernoudt/videolooper)\n- [https://github.com/asalisbury/videolooper](https://github.com/asalisbury/videolooper)\n- [http://www.timschwartz.org/raspberry-pi-video-looper/](http://www.timschwartz.org/raspberry-pi-video-looper/)\n\n### Useful links\n\n- [Shrinking disk images on linux](http://softwarebakery.com/shrinking-images-on-linux)\n- [How can I prevent my Pi's SD card from getting corrupted](http://raspberrypi.stackexchange.com/questions/7978/how-can-i-prevent-my-pis-sd-card-from-getting-corrupted-so-often?answertab=active#tab-top)\n- [Sound does not work with an HDMI monitor](http://elinux.org/R-Pi_Troubleshooting#Sound_does_not_work_with_an_HDMI_monitor)\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalanda%2Frpi-medialooper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkalanda%2Frpi-medialooper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalanda%2Frpi-medialooper/lists"}