Last active
December 18, 2015 16:38
-
-
Save janvojt/5812431 to your computer and use it in GitHub Desktop.
Video converter for compressing large videos from camera to x264.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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