Skip to content

Instantly share code, notes, and snippets.

@caseyanderson
Last active October 12, 2018 00:04
Show Gist options
  • Select an option

  • Save caseyanderson/548d182a1c03817692361d8019f14845 to your computer and use it in GitHub Desktop.

Select an option

Save caseyanderson/548d182a1c03817692361d8019f14845 to your computer and use it in GitHub Desktop.
A simple video looper for use with omxplayer on RPi, allows for setting sound output via command line
#!/bin/sh
# simple video looper
# Casey Anderson, 2018
# $1 is filepath to the video
# $2 sets sound: null for silent, hdmi for hdmi output, usb for alsa (usb audio adapter, assumes stereo)
# example: ./videolooper.sh /home/pi/nyan_cat.mp4 usb
if [ -z $2 ]; then
echo "no sound!"
omxplayer -b --loop --no-osd $1
elif [ $2 = 'hdmi' ]; then
echo "sound via hdmi"
omxplayer -b --loop --no-osd -o hdmi $1
elif [ $2 = 'usb' ]; then
echo "sound via usb"
omxplayer -b --loop --no-osd -o alsa:hw:1,0 $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment