I got a new computer, w00t! My family like to use the point-and-click camera for adhoc videos whilst we're out and about, the thing is it's very old and records in a rubbish AVI format which consumes massive amounts of disk space, b000!
After a bit of googling I wrote the below, it'll search through your disk and find AVI files, check that the file extension is .AVI and then convert it to .mp4; for bonus points it'll change the timestamp of the mp4 to match the avi so that it'll import into iPhoto albums nicely.
#!/bin.bash
export IFS=$'\n'
for i in $(find ./ -type f -name '*.AVI')
do
if [ ${i: -4} == ".AVI" ]
then
echo "Converting $i"
ffmpeg -i "$i" -s 480x320 -aspect 4:3 -b 768k -ab 64k -ar 22050 -r 30000/1001 "${i%.AVI}.mp4"
sleep 5
TSTAMP=`gls -l --time-style=+%Y%m%d%H%m "$i" | awk '{print $6}'`
touch -mt $TSTAMP "${i%.AVI}.mp4"
sleep 5
rm -f "$i"
fi
done
Quick Note: gls
is the GNU version of ls
not the built in BSD-MAC
version, you get it via homebrew
(brew install coreutils
)