From 059da01b326c9248c47937af6e04220a19a1bd6b Mon Sep 17 00:00:00 2001 From: timatron Date: Sat, 14 May 2016 15:02:10 -0600 Subject: [PATCH 01/19] Added USB support, full path, support files with spaces in names, support more file formats --- startvideo.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) mode change 100644 => 100755 startvideo.sh diff --git a/startvideo.sh b/startvideo.sh old mode 100644 new mode 100755 index e224881..d5c779e --- a/startvideo.sh +++ b/startvideo.sh @@ -1,28 +1,38 @@ #!/bin/bash # Bash script by Tim Schwartz, http://www.timschwartz.org/raspberry-pi-video-looper/ 2013 # Comments, clean up, improvements by Derek DeMoss, for Dark Horse Comics, Inc. 2015 +# Added USB support, full path, support files with spaces in names, support more file formats - Tim Schwartz, 2016 declare -A VIDS # make variable VIDS an Array -FILES=~/video/ # A variable of this folder +LOCAL_FILES=~/video/ # A variable of this folder +USB_FILES=/mnt/usbdisk/ # Variable for usb mount point CURRENT=0 # Number of videos in the folder SERVICE='omxplayer' # The program to play the videos PLAYING=0 # Video that is currently playing +FILE_FORMATS='.mov|.mp4|.mpg' getvids () # Since I want this to run in a loop, it should be a function { unset VIDS # Empty the VIDS array CURRENT=0 # Reinitializes the video count - -for f in `ls $FILES | grep .mp` # Step through the file in ~/video/ +IFS=$'\t' # Dont split up by spaces, only new lines when setting up the for loop +for f in `ls $LOCAL_FILES | grep -E $FILE_FORMATS` # Step through the local files do - VIDS[$CURRENT]=$f # add the filename found above to the VIDS array + VIDS[$CURRENT]=$LOCAL_FILES$f # add the filename found above to the VIDS array + # echo ${VIDS[$CURRENT]} # Print the array element we just added let CURRENT+=1 # increment the video count -# echo ${VIDS[$CURRENT]} # Print the array element we just added done +if [ -d "$USB_FILES" ]; then + for f in `ls $USB_FILES | grep -E $FILE_FORMATS` # Step through the usb files + do + VIDS[$CURRENT]=$USB_FILES$f # add the filename found above to the VIDS array + #echo ${VIDS[$CURRENT]} # Print the array element we just added + let CURRENT+=1 # increment the video count + done +fi } - while true; do if ps ax | grep -v grep | grep $SERVICE > /dev/null # Search for service, print to null then @@ -35,10 +45,8 @@ else PLAYING=0 # Reset to 0 so we play the "first" video fi - /usr/bin/omxplayer -r -o hdmi $FILES${VIDS[$PLAYING]} # Play video -# echo "Array size= $CURRENT" # error checking code + echo ${VIDS[$PLAYING]} + /usr/bin/omxplayer -r -o hdmi ${VIDS[$PLAYING]} # Play video + # echo "Array size= $CURRENT" # error checking code fi done - - - From 0f83fef817c8256042d4eb8da4dc8a79734014a1 Mon Sep 17 00:00:00 2001 From: timatron Date: Sat, 14 May 2016 15:20:32 -0600 Subject: [PATCH 02/19] newline instead of tab, whoops --- startvideo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/startvideo.sh b/startvideo.sh index d5c779e..1c46f35 100755 --- a/startvideo.sh +++ b/startvideo.sh @@ -16,7 +16,7 @@ getvids () # Since I want this to run in a loop, it should be a function { unset VIDS # Empty the VIDS array CURRENT=0 # Reinitializes the video count -IFS=$'\t' # Dont split up by spaces, only new lines when setting up the for loop +IFS=$'\n' # Dont split up by spaces, only new lines when setting up the for loop for f in `ls $LOCAL_FILES | grep -E $FILE_FORMATS` # Step through the local files do VIDS[$CURRENT]=$LOCAL_FILES$f # add the filename found above to the VIDS array From d9077d78cd8ad04cbf9f3a5135187d44f696757c Mon Sep 17 00:00:00 2001 From: timatron Date: Sat, 14 May 2016 16:01:08 -0600 Subject: [PATCH 03/19] only play if the video file exists --- startvideo.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/startvideo.sh b/startvideo.sh index 1c46f35..be1a970 100755 --- a/startvideo.sh +++ b/startvideo.sh @@ -45,8 +45,10 @@ else PLAYING=0 # Reset to 0 so we play the "first" video fi - echo ${VIDS[$PLAYING]} - /usr/bin/omxplayer -r -o hdmi ${VIDS[$PLAYING]} # Play video + #echo ${VIDS[$PLAYING]} + if [ -f ${VIDS[$PLAYING]} ]; then + /usr/bin/omxplayer -r -o hdmi ${VIDS[$PLAYING]} # Play video + fi # echo "Array size= $CURRENT" # error checking code fi done From a5a1cda8bf29e1adec8a6facbade7159a3e456bf Mon Sep 17 00:00:00 2001 From: timatron Date: Sat, 14 May 2016 16:06:24 -0600 Subject: [PATCH 04/19] adding check that there are videos to play, if not sleep --- startvideo.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/startvideo.sh b/startvideo.sh index be1a970..44c002e 100755 --- a/startvideo.sh +++ b/startvideo.sh @@ -39,16 +39,22 @@ then echo 'running' else getvids # Get a list of the current videos in the folder - let PLAYING+=1 - if [ $PLAYING -ge $CURRENT ] # if PLAYING is greater than or equal to CURRENT + if [ $CURRENT -ge 0 ] #only play videos if there are more than one video then - PLAYING=0 # Reset to 0 so we play the "first" video - fi + let PLAYING+=1 + if [ $PLAYING -ge $CURRENT ] # if PLAYING is greater than or equal to CURRENT + then + PLAYING=0 # Reset to 0 so we play the "first" video + fi - #echo ${VIDS[$PLAYING]} - if [ -f ${VIDS[$PLAYING]} ]; then - /usr/bin/omxplayer -r -o hdmi ${VIDS[$PLAYING]} # Play video + #echo ${VIDS[$PLAYING]} + if [ -f ${VIDS[$PLAYING]} ]; then + /usr/bin/omxplayer -r -o hdmi ${VIDS[$PLAYING]} # Play video + fi + # echo "Array size= $CURRENT" # error checking code + else + echo "Insert USB or add videos to /home/pi/video, sleeping for 5 seconds" + sleep 5 fi - # echo "Array size= $CURRENT" # error checking code fi done From 72b6d253e5eb0277e6b7d713e09b9439b8a20474 Mon Sep 17 00:00:00 2001 From: timatron Date: Sat, 14 May 2016 16:16:48 -0600 Subject: [PATCH 05/19] more clear --- startvideo.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/startvideo.sh b/startvideo.sh index 44c002e..24fff1a 100755 --- a/startvideo.sh +++ b/startvideo.sh @@ -39,7 +39,7 @@ then echo 'running' else getvids # Get a list of the current videos in the folder - if [ $CURRENT -ge 0 ] #only play videos if there are more than one video + if [ $CURRENT -gt 0 ] #only play videos if there are more than one video then let PLAYING+=1 if [ $PLAYING -ge $CURRENT ] # if PLAYING is greater than or equal to CURRENT @@ -53,8 +53,8 @@ else fi # echo "Array size= $CURRENT" # error checking code else - echo "Insert USB or add videos to /home/pi/video, sleeping for 5 seconds" - sleep 5 + echo "Insert USB with videos and restart or add videos to /home/pi/video and run ./startvideo.sh" + exit fi fi done From 6e56cbf0291c7ff55c43dfcdd063526ec828111e Mon Sep 17 00:00:00 2001 From: timatron Date: Sun, 15 May 2016 16:07:46 -0600 Subject: [PATCH 06/19] documentation --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 93a5869..a07bbe0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,46 @@ -# videolooper-raspbian -Automatically play full screen videos on a Raspberry Pi (2). -The original by Tim Schwartz, http://www.timschwartz.org/raspberry-pi-video-looper/ +#Video Looper for Raspbian +Automatically play and loop full screen videos on a Raspberry Pi 2 or 3. +Original by [Tim Schwartz](http://www.timschwartz.org/raspberry-pi-video-looper/) + +This system uses a basic bash script to play videos with [omxplayer](http://elinux.org/Omxplayer), it simply checks if omxplayer isn't running and then starts it again. This simple method seems to work flawlessly for weeks on end without freezing or glitches. The only caveat of this method is that there are approximately 2-3 seconds of black between each video. If you are looking to do something with gapless looping on Raspberry Pi, try [Slooper](https://github.com/mokafolio/Slooper) by [Matthias Dörfelt](http://www.mokafolio.de/), though currently it needs a few updates to work without a remote (as of May 15, 2016). + +There is a [videolooper](https://github.com/adafruit/pi_video_looper) written in python that uses omxplayer by [Adafruit](http://www.adafruit.com), but unfortunately on testing looping videos for more than a day it froze (as of May 15, 2016). + +The script will look for videos either in: +* the `video` directory in the home directory of the pi user +* a usb stick plugged in before startup (this will not be remounted if you pull it out and plug it back in) + +There are two methods of installation, either: +* Grab your own [raspbian img](https://www.raspberrypi.org/downloads/raspbian/), install it on the pi, and follow the steps below to install the videolooper. +* Copy the prebuilt img that has already been setup using the steps below (`2016-05-10-raspbian-jessie-lite` was used as the base image). + +##Script Installation + +###Install omxplayer +`sudo apt-get update` +`sudo apt-get -y install omxplayer` + +###Setup auto mounting of usb stick +`sudo mkdir -p /mnt/usbdisk` +`sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab` +`sudo mount /mnt/usbdisk` + +###Create folder for videos in home directory +mkdir /home/pi/video + +###Download startvideo.sh and put it in /home/pi/ +`wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh'` +`chmod uga+rwx startvideo.sh` + +###Add startvideo.sh to .bashrc so it auto starts on login +`echo \"/home/pi/startvideo.sh" | tee -a /home/pi/.bashrc` + +###Make system autoboot into pi user +`sudo raspi-config` +* Select option: "3 Boot Options" +* Select option: "B2 Console Autologin" + +###Expand your root partition if you want to +`sudo raspi-config` +* Select option: "1 Expand Filesystem" + From d65e16700359c9748848585c1557dd0cc9123168 Mon Sep 17 00:00:00 2001 From: timatron Date: Sun, 15 May 2016 16:35:12 -0600 Subject: [PATCH 07/19] readability --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a07bbe0..0f758b5 100644 --- a/README.md +++ b/README.md @@ -17,20 +17,20 @@ There are two methods of installation, either: ##Script Installation ###Install omxplayer -`sudo apt-get update` -`sudo apt-get -y install omxplayer` +```sudo apt-get update +sudo apt-get -y install omxplayer``` ###Setup auto mounting of usb stick -`sudo mkdir -p /mnt/usbdisk` -`sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab` -`sudo mount /mnt/usbdisk` +```sudo mkdir -p /mnt/usbdisk +sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab +sudo mount /mnt/usbdisk``` ###Create folder for videos in home directory -mkdir /home/pi/video +`mkdir /home/pi/video` ###Download startvideo.sh and put it in /home/pi/ -`wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh'` -`chmod uga+rwx startvideo.sh` +```wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh' +chmod uga+rwx startvideo.sh``` ###Add startvideo.sh to .bashrc so it auto starts on login `echo \"/home/pi/startvideo.sh" | tee -a /home/pi/.bashrc` From 7471f32d65edfe3da1c8d37a59d8141f75271ad2 Mon Sep 17 00:00:00 2001 From: timatron Date: Sun, 15 May 2016 16:39:19 -0600 Subject: [PATCH 08/19] readabiltity --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0f758b5..13be52b 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,14 @@ There are two methods of installation, either: ###Install omxplayer ```sudo apt-get update + sudo apt-get -y install omxplayer``` ###Setup auto mounting of usb stick ```sudo mkdir -p /mnt/usbdisk + sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab + sudo mount /mnt/usbdisk``` ###Create folder for videos in home directory @@ -30,6 +33,7 @@ sudo mount /mnt/usbdisk``` ###Download startvideo.sh and put it in /home/pi/ ```wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh' + chmod uga+rwx startvideo.sh``` ###Add startvideo.sh to .bashrc so it auto starts on login From 65c4d1768e7d2a51e489c6f8298682cd8e1ebae6 Mon Sep 17 00:00:00 2001 From: timatron Date: Sun, 15 May 2016 16:39:57 -0600 Subject: [PATCH 09/19] work --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 13be52b..9607966 100644 --- a/README.md +++ b/README.md @@ -18,23 +18,22 @@ There are two methods of installation, either: ###Install omxplayer ```sudo apt-get update - -sudo apt-get -y install omxplayer``` +sudo apt-get -y install omxplayer +``` ###Setup auto mounting of usb stick ```sudo mkdir -p /mnt/usbdisk - sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab - -sudo mount /mnt/usbdisk``` +sudo mount /mnt/usbdisk +``` ###Create folder for videos in home directory `mkdir /home/pi/video` ###Download startvideo.sh and put it in /home/pi/ ```wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh' - -chmod uga+rwx startvideo.sh``` +chmod uga+rwx startvideo.sh +``` ###Add startvideo.sh to .bashrc so it auto starts on login `echo \"/home/pi/startvideo.sh" | tee -a /home/pi/.bashrc` From 81b1e90e15b8095d18e82fb24a1c3789045b5eca Mon Sep 17 00:00:00 2001 From: timatron Date: Sun, 15 May 2016 16:40:23 -0600 Subject: [PATCH 10/19] really work --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9607966..1e99b0a 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,14 @@ There are two methods of installation, either: ##Script Installation ###Install omxplayer -```sudo apt-get update +``` +sudo apt-get update sudo apt-get -y install omxplayer ``` ###Setup auto mounting of usb stick -```sudo mkdir -p /mnt/usbdisk +``` +sudo mkdir -p /mnt/usbdisk sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab sudo mount /mnt/usbdisk ``` @@ -31,7 +33,8 @@ sudo mount /mnt/usbdisk `mkdir /home/pi/video` ###Download startvideo.sh and put it in /home/pi/ -```wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh' +``` +wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh' chmod uga+rwx startvideo.sh ``` From b8829139affecf5526a95079242389136e287975 Mon Sep 17 00:00:00 2001 From: timatron Date: Mon, 23 May 2016 10:47:26 -0700 Subject: [PATCH 11/19] Update README.md updating fstab usb mount option --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e99b0a..70ef604 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,7 @@ sudo apt-get -y install omxplayer ###Setup auto mounting of usb stick ``` sudo mkdir -p /mnt/usbdisk -sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,defaults 0 0\" | sudo tee -a /etc/fstab -sudo mount /mnt/usbdisk +sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,nofail 0 0\" | sudo tee -a /etc/fstab ``` ###Create folder for videos in home directory @@ -49,4 +48,3 @@ chmod uga+rwx startvideo.sh ###Expand your root partition if you want to `sudo raspi-config` * Select option: "1 Expand Filesystem" - From 52796e753754b670e5e08a2e2040a16b9437e8e4 Mon Sep 17 00:00:00 2001 From: timatron Date: Mon, 23 May 2016 10:49:39 -0700 Subject: [PATCH 12/19] updating link for startvideo.sh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 70ef604..7eed5bb 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,nofail 0 0\" | sudo tee -a /etc/fsta ###Download startvideo.sh and put it in /home/pi/ ``` -wget https://raw.githubusercontent.com/derekcat/videolooper-raspbian/master/startvideo.sh' +wget https://raw.githubusercontent.com/timatron/videolooper-raspbian/master/startvideo.sh chmod uga+rwx startvideo.sh ``` From efd2f0e37e7ca1effd0007417f329b2996e85dc6 Mon Sep 17 00:00:00 2001 From: timatron Date: Mon, 23 May 2016 10:51:08 -0700 Subject: [PATCH 13/19] dont really need my name everywhere --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7eed5bb..0bee595 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ #Video Looper for Raspbian Automatically play and loop full screen videos on a Raspberry Pi 2 or 3. -Original by [Tim Schwartz](http://www.timschwartz.org/raspberry-pi-video-looper/) This system uses a basic bash script to play videos with [omxplayer](http://elinux.org/Omxplayer), it simply checks if omxplayer isn't running and then starts it again. This simple method seems to work flawlessly for weeks on end without freezing or glitches. The only caveat of this method is that there are approximately 2-3 seconds of black between each video. If you are looking to do something with gapless looping on Raspberry Pi, try [Slooper](https://github.com/mokafolio/Slooper) by [Matthias Dörfelt](http://www.mokafolio.de/), though currently it needs a few updates to work without a remote (as of May 15, 2016). From 1411c30d65f94875402d50c6a6083a17ff87bd68 Mon Sep 17 00:00:00 2001 From: timatron Date: Tue, 24 May 2016 16:36:21 -0700 Subject: [PATCH 14/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bee595..c98e141 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The script will look for videos either in: There are two methods of installation, either: * Grab your own [raspbian img](https://www.raspberrypi.org/downloads/raspbian/), install it on the pi, and follow the steps below to install the videolooper. -* Copy the prebuilt img that has already been setup using the steps below (`2016-05-10-raspbian-jessie-lite` was used as the base image). +* Copy the [prebuilt img](http://timschwartz.org/downloads/2016-05-10-raspbian-jessie-lite-video-looper.img.zip) that has already been setup using the steps below (`2016-05-10-raspbian-jessie-lite` was used as the base raspbian image). ##Script Installation From 080e2817ec28a054fa59a0467d5e2baeea54d26c Mon Sep 17 00:00:00 2001 From: timatron Date: Tue, 24 May 2016 16:50:06 -0700 Subject: [PATCH 15/19] cleaner --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c98e141..f0a9540 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,13 @@ The script will look for videos either in: * the `video` directory in the home directory of the pi user * a usb stick plugged in before startup (this will not be remounted if you pull it out and plug it back in) -There are two methods of installation, either: -* Grab your own [raspbian img](https://www.raspberrypi.org/downloads/raspbian/), install it on the pi, and follow the steps below to install the videolooper. -* Copy the [prebuilt img](http://timschwartz.org/downloads/2016-05-10-raspbian-jessie-lite-video-looper.img.zip) that has already been setup using the steps below (`2016-05-10-raspbian-jessie-lite` was used as the base raspbian image). +#Installation -##Script Installation +##Grab 'n Go +Copy the [prebuilt img](http://timschwartz.org/downloads/2016-05-10-raspbian-jessie-lite-video-looper.img.zip) to a micro SD card. The img was setup using the steps below and `2016-05-10-raspbian-jessie-lite` was used as the base raspbian image. + +##Roll Your Own +Start with a [raspbian img](https://www.raspberrypi.org/downloads/raspbian/), install it on the pi, and follow the steps below to install the videolooper. ###Install omxplayer ``` From 64aa418162dd29d21ddb81857814c4b8785c6e31 Mon Sep 17 00:00:00 2001 From: timatron Date: Thu, 26 May 2016 10:29:55 -0700 Subject: [PATCH 16/19] instructions link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0a9540..b105f72 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The script will look for videos either in: #Installation ##Grab 'n Go -Copy the [prebuilt img](http://timschwartz.org/downloads/2016-05-10-raspbian-jessie-lite-video-looper.img.zip) to a micro SD card. The img was setup using the steps below and `2016-05-10-raspbian-jessie-lite` was used as the base raspbian image. +Copy the [prebuilt img](http://timschwartz.org/downloads/2016-05-10-raspbian-jessie-lite-video-looper.img.zip) to a micro SD card using [these instructions](https://www.raspberrypi.org/documentation/installation/installing-images/). The img was setup using the steps below and `2016-05-10-raspbian-jessie-lite` was used as the base raspbian image. ##Roll Your Own Start with a [raspbian img](https://www.raspberrypi.org/downloads/raspbian/), install it on the pi, and follow the steps below to install the videolooper. From 07f3a2f1bef8145d9667af354970d9d45697d2a4 Mon Sep 17 00:00:00 2001 From: timatron Date: Thu, 26 May 2016 10:32:42 -0700 Subject: [PATCH 17/19] fullscreen --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b105f72..b02085a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ #Video Looper for Raspbian -Automatically play and loop full screen videos on a Raspberry Pi 2 or 3. +Automatically play and loop fullscreen videos on a Raspberry Pi 2 or 3. This system uses a basic bash script to play videos with [omxplayer](http://elinux.org/Omxplayer), it simply checks if omxplayer isn't running and then starts it again. This simple method seems to work flawlessly for weeks on end without freezing or glitches. The only caveat of this method is that there are approximately 2-3 seconds of black between each video. If you are looking to do something with gapless looping on Raspberry Pi, try [Slooper](https://github.com/mokafolio/Slooper) by [Matthias Dörfelt](http://www.mokafolio.de/), though currently it needs a few updates to work without a remote (as of May 15, 2016). From f22fef4382c9054725826d9abf3b87f1e50fbc4d Mon Sep 17 00:00:00 2001 From: timatron Date: Thu, 26 May 2016 10:41:41 -0700 Subject: [PATCH 18/19] get in the right dir --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b02085a..8b16fe3 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ sudo echo \"/dev/sda1 /mnt/usbdisk vfat ro,nofail 0 0\" | sudo tee -a /etc/fsta ###Download startvideo.sh and put it in /home/pi/ ``` +cd /home/pi wget https://raw.githubusercontent.com/timatron/videolooper-raspbian/master/startvideo.sh chmod uga+rwx startvideo.sh ``` From 2c610e07dd92612b04b536d52204c3fb8981fd8a Mon Sep 17 00:00:00 2001 From: Brad Isbell Date: Wed, 13 Jun 2018 11:57:21 -0700 Subject: [PATCH 19/19] Make filename extensions case-insensitive It's not uncommon to have file name extensions with varying case, especially with older filesystems on USB media. This change allows matching of file name extensions that aren't just lower case. --- startvideo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/startvideo.sh b/startvideo.sh index 24fff1a..ef4331e 100755 --- a/startvideo.sh +++ b/startvideo.sh @@ -17,14 +17,14 @@ getvids () # Since I want this to run in a loop, it should be a function unset VIDS # Empty the VIDS array CURRENT=0 # Reinitializes the video count IFS=$'\n' # Dont split up by spaces, only new lines when setting up the for loop -for f in `ls $LOCAL_FILES | grep -E $FILE_FORMATS` # Step through the local files +for f in `ls $LOCAL_FILES | grep -i -E $FILE_FORMATS` # Step through the local files do VIDS[$CURRENT]=$LOCAL_FILES$f # add the filename found above to the VIDS array # echo ${VIDS[$CURRENT]} # Print the array element we just added let CURRENT+=1 # increment the video count done if [ -d "$USB_FILES" ]; then - for f in `ls $USB_FILES | grep -E $FILE_FORMATS` # Step through the usb files + for f in `ls $USB_FILES | grep -i -E $FILE_FORMATS` # Step through the usb files do VIDS[$CURRENT]=$USB_FILES$f # add the filename found above to the VIDS array #echo ${VIDS[$CURRENT]} # Print the array element we just added