AVI to MP4 v0.2
May 8th, 2008
SHA1 Key: cde797c8a9eba7c7fb2878f53a718a2cdb60ba0a
Description: Convert any avi files to psp (mp4). Using MPEG4 video codec (480×272), and AAC audio codec.
#!/bin/bash
# avi2mp4 v0.2 by EMCGFX
# Convert avi files to mp4 for psp.
# Using MPEG4 video and AAC audio codecs.
# Original Script mpg2avi By Steel_J
# Convert mpeg streams into high quality mpeg4 avi with mp3 audio.
# requirements: mplayer/mencoder
# Usage:
# 0. chmod +x avi2mp4.sh
# 1. copy this script to any folder with avi files.
# 2. execute the script, ./avi2mp4.sh *
# (to remove spaces from filenames)
# 3. execute the script, ./avi2mp4.sh
# (to start converting all the files in directory)
# v0.2
# changed: replaced _ with . character in filenames.
# changed: -o "'basename "$i"'.mp4" to -o ""$i".mp4";
# removed: current_directory=$( pwd )
# v0.1 -- first release.
# Begin
clear
# remove spaces
for i in *.[Aa][Vv][Ii];
do mv "$i" `echo $i | tr ' ' '.'`;
done > /dev/null 2>&1 &
# remove uppercase
for i in *.[Aa][Vv][Ii];
do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`;
done > /dev/null 2>&1 &
# convert avi movies into mp4's with mencoder
for i in *.[Aa][Vv][Ii];
do nice -n 10 mencoder -ovc lavc -oac lavc -of lavf \
-lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:vbitrate=800:\
threads=4:acodec=libfaac -af lavcresample=24000 \
-vf scale=480:272,harddup -lavfopts format=psp \
-ofps 30000/1001 $i -o ""$i".mp4";
echo "Finished";
done
exit;

