Skip to content

Instantly share code, notes, and snippets.

@oe7drt
Created September 1, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oe7drt/3ca5f567b8382df744a597985d3c6756 to your computer and use it in GitHub Desktop.
Save oe7drt/3ca5f567b8382df744a597985d3c6756 to your computer and use it in GitHub Desktop.
Convert camera videos into x264 mpeg files
#!/bin/bash
# for i in *.MP4; do ffmpeg -i $i -vcodec libx264 -crf 21 -an out/$i && mv $i $i.done; done
c=0
d=$(date +%Y%m%d)
if [ ! -d "done/$d" ]; then
mkdir "done/$d"
fi
if [ ! -d "out/$d" ]; then
mkdir "out/$d"
fi
for file in *.MP4; do
echo -en "Converting file '$file'..."
ffmpeg -i "$file" -vcodec libx264 -crf 21 -an "out/$d/$file" && mv "$file" "done/$d/$file"
echo -en " done. Moved file '$file' to 'done/$d/$file'.\n"
echo -en "Converted file to: 'out/$d/$file'\n"
(( ++c ))
done
echo -en "\nFinished. Converted $c files.\n"
# vim: set syntax=sh ft=sh ts=2 sw=2 tw=0 et :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment