Monday, September 30, 2013

Raspberry Pi Automatic Video Looper


Download the image here:
https://onedrive.live.com/redir?resid=e0f17bd2b1ffe81!411&authkey=!AGW37ozZuaeyjDw&ithint=file%2czip

MIRROR: https://mega.co.nz/#!JBcDxLhQ!z41lixcpCS0-zvF2X9SkX-T98Gj5I4m3QIFjXKiZ5p4

Recently I helped out with an Architecture exhibition where they needed 8 projectors looping videos all at the same time. Deciding they didn't want to pay for 8 computers and pay for the electricity for 8 computers, they contacted me to see if I could help (Pictures to come soon!). They got 8 Raspberry Pis, which together cost less than one PC and use less an energy than one PC. That's over 16 times the cost savings and energy savings.

I found a link that did this here. However, it has a couple big issues. It only supports certain file types, doesn't allow spaces in the files and a couple of other things, the escape key stops the whole loop, and their is a longer delay than I want. It also doesn't have the newest version of omxplayer, which plays subtitles and has other new fixes.

So I started creating my own and my version fixes these problems. So I now have decided to publish my image here.

How to set up the looper

  1. Copy this image to an SD card following these directions
  2. Put your video files in the /home/pi/videos directory
  3. Plug it in

Features

  • Supports all raspberry pi video types (mp4,avi,mkv,mp3,mov,mpg,flv,m4v)
  • Supports subtitles (just put the srt file in the same directory as the videos)
  • Reduces time between videos
  • Allows spaces and special characters in the filename
  • Allows pausing and skipping
  • Full screen with a black background and no flicker
  • SSH automatically enabled with user:pi and password:raspberry
  • Allows easy video conversion using ffmpeg (ffmpeg INFILE -sameq OUTFILE)
  • Has a default of HDMI audio output with one quick file change (replace -o hdmi with -o local in startvideos.sh).
  • Can support external HDDs and other directories easily with one quick file change (Change FILES=/home/pi/videos/ to FILES=/YOUR DIRECTORY/ in startvideos.sh)

Source code

The source code can be found on github here. There are a couple main files listed below:
startvideos.sh
startfullscreen.sh
videoloop

This is perfect if you are working on a museum or school exhibit. Don't spend a lot of money and energy on a PC running windows and have problems like below (courtesy of the Atlanta Aquarium).

If you are a museum or other educationally based program and need help, you can contact me by e-mail at help@stevenhickson.com

Consider donating to further my tinkering since I do all this and help people out for free.

Places you can find me

Monday, September 16, 2013

PiAUISuite Update and Voicecommand v3.1

Voicecommand allows you to control your raspberry pi using only your voice. More information and videos on this can be found on my YouTube channel or the original blog posts.

I've made a couple of key changes and their is a new option for people who want to help with the sox implementation to make the speech recognition more continuous rather than chunk-based.


  • The bug in the voicecommand -s hardware has been fixed.
  • Allows multilingual support with !lang and !language
  • Fixed casing bug when matching multiple variables
  • Install, Uninstall, and Update scripts are now seperated by project. So now if you want to only update youtube, just run UpdateAUISuite.sh youtube
  • tts and tts-nofill have been combined.
  • Moving away from yt.js to browse youtube in the browser. Now adding node.js youtube browsing API. See https://github.com/StevenHickson/RaspberryPiTV
  • Building https://github.com/StevenHickson/RaspberryPiTV to work with voicecommand and adding omxcontrols using https://github.com/StevenHickson/omxplayer_fifo
  • With the above, this allows a control panel that can control videos, play pandora, browse youtube, control music, and run voicecommand. Note that this is in beta and will require a lot of manual installation as their is no installation or readme yet (Hopefully soon to come).
  • Added youtube-dl cron update so that youtube-dl updates automatically every night. Often if someone says the youtube script doesn't work, it is because youtube-dl is out of date and YouTube has updated their security algorithms. Running sudo youtube-dl -U often fixes this problem.
  • Added an option in speech-recog.sh to use sox instead of arecord. Simply uncomment out the sox portion and comment the arecord portion in /usr/bin/speech-recog.sh as below:

sox -r 16000 -t alsa $hardware /dev/shm/out.flac silence 1 0.3 1% 1 0.5 1%
wget -q -U "rate=16000" -O - --post-file /dev/shm/out.flac --header="Content-Type: audio/x-flac; rate=16000" "http://www.google.com/speech-api/v1/recognize?lang=en&client=Mozilla/5.0" | sed -e 's/[{}]/''/g'| awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]; exit }' | awk -F: 'NR==3 { print $3; exit }'
#arecord -D $hardware -f cd -t wav -d $duration -r 16000 | flac - -f --best --sample-rate 16000 -o /dev/shm/out.flac 1>/dev/shm/voice.log 2>/dev/shm/voice.log; wget -O - -o /dev/null --post-file /dev/shm/out.flac --header="Content-Type: audio/x-flac; rate=16000" http://www.google.com/speech-api/v1/recognize?lang="$lang" | sed -e 's/[{}]/''/g'| awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]; exit }' | awk -F: 'NR==3 { print $3; exit }'
rm /dev/shm/out.flac
Please let me know how this works for people so I can debug and get this working permanently.  As always, you can find the install, update, and new YouTube videos at my YouTube channel here:
If you are wondering why I've been so quiet, it's because I moved, started grad school at Georgia Tech, and have been doing a technical review for a computer vision book.
Since I'm a poor graduate student, please support my tinkering:


Places you can find me
Get 10% offsitewide when you shop at
at Yescom USA. Valid until October 2013! Retractable Banner Stand at Yescom USA . Valid until October 2013!