Re-encode video files to Iphone format in Ubuntu
Copy the script and paste it into a file named recode_mp4.sh.
#!/bin/bash for file in "$@" do while [ -n "$(ps -ef | egrep "ffmpeg" | grep -v grep)" ]; do echo -e "\n[$(date +%b\ %d\ %Y:\ %H:%M:%S)]\nFound another instance of \ HandBrake or ffmpeg running, pausing 5 minutes..." sleep 300 done fnout=${file} ffmpeg -i "${file}" -acodec libfaac -aq 100 -ac 2 -vcodec libx264 -vpre \ slow -vpre ipod640 -crf 26 -map_meta_data 0:0 -vf scale=640:-1 \ -threads 0 "${fnout}".mp4 done exit 0
*Tip: Combine the lines separated by "\" as they are there only there to improve readability.
Install ffmpeg, using this guide.
Now you can run ./recode_mp4.sh video_file.ext to recode that video file or ./recode_mp4.sh * to recode all files in the directory you are in.