Skip to content

Instantly share code, notes, and snippets.

@cstroie
Created January 29, 2014 14:33
Show Gist options
  • Save cstroie/8689208 to your computer and use it in GitHub Desktop.
Save cstroie/8689208 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Convert all mjpg AVI movies created by Niokon camera to mp4
if [ ! "$1" ]
then
find . -iname '*.avi' -exec "$0" "{}" \;
exit 1
fi
I="$1"
B="${I##*/}"
P="${I%/*}"
N="${B%.*}"
X="${B##*.}"
[ "$X" = "AVI" ] && Z="MP4" || Z="mp4"
O="$N.$Z"
if [ ! -f "$P/$O" ]
then
echo "Converting $I to $P/$O"
HandBrakeCLI -C 1 -O -Z Normal -i "$I" -o "$P/$O"
fi
# vim: set ft=sh ai ts=2 sts=2 et sw=2 sta nowrap nu:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment