Skip to content

Instantly share code, notes, and snippets.

@janvojt
Last active December 18, 2015 16:38
Show Gist options
  • Save janvojt/5812431 to your computer and use it in GitHub Desktop.
Save janvojt/5812431 to your computer and use it in GitHub Desktop.
Video converter for compressing large videos from camera to x264.
#!/bin/bash
# author: Jan Vojt
path="$1"
br="1200k"
res="1280x720"
vcodec="libx264"
if [ -z "$path" ]; then
echo "Please enter path as first argument."
exit
fi
find "$path" -iname "*.avi" | while read vid; do
fname=`echo "$vid" | grep -o ".*\\." | sed 's/\.$//'`
fext=`echo "$vid" | grep -o "\\.[^\\.]*$"`
outname="${fname}-${res}-${br}.mp4"
if [ -s "$outname" ]; then
echo "Skipping $outname, already exists."
else
ffmpeg -i "$vid" -vb $br -s $res -vcodec $vcodec "$outname" < /dev/null
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment