Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Small util script to convert *.mpeg to *.avi :)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
mikepb78
Apprentice
Apprentice


Joined: 27 Feb 2003
Posts: 171
Location: London

PostPosted: Mon Apr 21, 2003 11:47 am    Post subject: Small util script to convert *.mpeg to *.avi :) Reply with quote

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";
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum