Convert DivX - Xvid to PS3 Format mpeg4 on linux
Is not cool to only be able to browse movies and not been able to see them unless they are mpeg4 on the ps3… so a fast and easy way to convert them is this:
First install GPAC
(GPAC is an implementation of the MPEG-4 Systems standard developed from scratch in ANSI C)
using gentoo:
emerge media-video/gpac
if using other system:
apt-get install gpac or just get it from the home page here
I found this lite batch script the other day on the ps3forums:
#!/bin/sh
##Released under the GPL.
## www.subvida.com
## Carlos Rivero
function usage {
cat eof $0 inputFile outputFile bitrate
where
inputFile: The video to convert
outoutFile: The output video
bitrate: bitrate for the output (ex: 2000)
EOF
exit 1
}
[ $# -lt 3 ] && usage
echo "EXECUTING COMMAND: mencoder $1 -ovc x264 -oac faac -x264encopts subq=6:pass=1:bitrate=$3:bframes=3:partitions=p8x8,b8x8,i4x4:weight_b:threads=auto:nopsnr:nossim:frameref=3:mixed_refs:bime:brdo:level_idc=41:direct_pred=auto:trellis=1 -o "$2.avi""
echo "Now converting to AVC. This will take the most time." + `date`
mencoder $1 -ovc x264 -oac faac -x264encopts subq=6:pass=1:bitrate=$3:bframes=3:partitions=p8x8,b8x8,i4x4:weight_b:threads=auto:nopsnr:nossim:frameref=3:mixed_refs:bime:brdo:level_idc=41:direct_pred=auto:trellis=1 -o "$2.avi"
echo "Now converting avi to MP4, due to limitations."
MP4Box -aviraw video $2.avi
MP4Box -aviraw audio $2.avi
mv $2_audio.raw $2_audio.aac
MP4Box -add $2_audio.aac -add $2_video.h264 $2.mp4
which should be run like: bashscript INPUT.avi OUTPUT bitrate
use this script in conjunction with this
*NOTE: replace line 6
cat eof $0 inputFile outputFile bitrate
by
cat <<eof $0 inputFile outputFile bitrate








Replace line 6 with the 2 following lines:
cat
cat <<EOF
$0 inputFile outputFile bitrate
#!/bin/sh
##Released under the GPL.
## http://www.subvida.com
## Carlos Rivero
#
# MP4Box is in the Ubuntu package ‘gpac’.
#
# ver 1.1 by Johan Karlsson
# * no skipping of duplicate frames causing sound to lose sync
# * no useless divx2pass file created
# * cleaning up junk files
# * checking that input file exists
if [ $1 = "--help" ]
then
echo “ps3videncode inputFile outputFile bitrate
inputFile: The video to convert (ex: terminator.mkv)
outoutFile: The output video (ex: mymovie)
bitrate: bitrate for the output (ex: 2000)”
exit 1
fi
if [ ! -e $1 ]; then
echo “Input file not found ($1)”
exit 1
fi
echo “EXECUTING COMMAND: mencoder $1 -ovc x264 -oac faac -x264encopts subq=6:pass=1:bitrate=$3:bframes=3:partitions=p8×8,b8×8,i4×4:weight_b:threads=auto:nopsnr:nossim:frameref=3:mixed_refs:bime:brdo:level_idc=41:direct_pred=auto:trellis=1 -o “$2.avi”"
echo “Now converting to AVC. This will take the most time.” + `date`
mencoder $1 -ovc x264 -oac faac -faacopts br=128:mpeg=4:object=2 -x264encopts subq=6:bitrate=$3:bframes=3:partitions=p8×8,b8×8,i4×4:weight_b:threads=auto:nopsnr:nossim:frameref=3:mixed_refs:bime:brdo:level_idc=41:direct_pred=auto:trellis=1 -vf harddup -o “$2.avi”
echo “Now converting avi to MP4, due to limitations.”
MP4Box -aviraw video $2.avi
MP4Box -aviraw audio $2.avi
mv $2_audio.raw $2_audio.aac
MP4Box -add $2_audio.aac -add $2_video.h264 $2.mp4
echo “cleaning up”
rm $2_audio.aac
rm $2_video.h264
rm $2.avi
———————–
Thanks for the script. I made some improvements to it and thought they might be interesting for other PS3 users.