Skip to content

Instantly share code, notes, and snippets.

@shoaibi
Created June 25, 2015 15:18
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 shoaibi/1654c2b4e9184647a0ff to your computer and use it in GitHub Desktop.
Save shoaibi/1654c2b4e9184647a0ff to your computer and use it in GitHub Desktop.
Convert video files in the specified path for my phone(SG4)
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: $0 sourceExtension /path/to/source/files /path/to/save/converted/files"
exit 65
fi
cd "$2"
for fileName in *"$1"; do
baseFileName="${fileName%.*}"
echo "Converting $fileName"
sudo nice -n -15 mencoder "$fileName" -oac mp3lame -ovc xvid -xvidencopts pass=1 -sid 0 -vf scale=480:320 -o "$3/$baseFileName.mp4" &> "/tmp/mencoder.log"
done
echo "Done!"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment