mikepb78 Apprentice
Joined: 27 Feb 2003 Posts: 171 Location: London
|
Posted: Mon Apr 21, 2003 11:47 am Post subject: Small util script to convert *.mpeg to *.avi :) |
|
|
Here is a small hack of a script to convert a whole lot of movie in a dir to divx/xvid.
Code: | #/bin/sh
# This is where the encoded video is going to be :
mkdir videoout
abitrate="96"
vbitrate="1600"
mask="*.mpeg"
for x in $mask; do
echo "Converting $x"
mencoder -ofps 25 -sws 2 -vop scale=320:240 -o /dev/null -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbitrate:vhq:v4mv:trell:vpass=1 $x > /dev/null 2> /dev/null
echo " pass 1 done for $x"
mencoder -ofps 25 -sws 2 -vop scale=320:240 -o videoout/$x.avi -oac mp3lame -lameopts preset=$abitrate -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbitrate:vhq:v4mv:trell:vpass=2 $x > /dev/null 2> /dev/null
echo " pass 2 done for $x"
# mencoder -sws 2 -vop scale=320:240 -ovc xvid -oac copy -xvidencopts 4mv:me_quality=6:mod_quant:quant_range=1-31/1-31:bitrate=$vbitrate:pass=2 -o /dev/null $x > /dev/null 2> /dev/null
# mencoder -sws 2 -vop scale=320:240 -ovc xvid -oac mp3lame -lameopts preset=$abitrate -xvidencopts 4mv:me_quality=6:mod_quant:quant_range=1-31/1-31:bitrate=$vbitrate:pass=2 -o videoout/$x-xvid.avi $x > /dev/null 2> /dev/null
done
echo "All Done" |
You can drop the scale and ofps part or get that info from Video::Info. IE :
Code: | #!/usr/bin/perl
## Print Info on a movie
use Video::Info;
my $info = Video::Info->new(-file=>$ARGV[0]);
print "Filename : " . $ARGV[0] . "\n";
print "Video Codec : " . $info->vcodec() . "\n";
print "Video Bitrate : " . $info->vrate()/1000 . " kb \n";
print "Audio Codec : " . $info->acodec() . "\n";
print "Audio Bitrate : " . $info->arate()/1000 . " kb \n";
print "Dimensions : " . $info->width() . "x" . $info->height() . "\n";
#print "Aspect Ratio : " . $info->aspect() . "\n";
print "Frames Per Second : " . $info->fps() . "\n";
print "Duration in Seconds : " . $info->duration() . "\n";
print "Video Frames : " . $info->vframes() . "\n"; |
|
|