[plug] TV Ripping
Mike Holland
myk.list at westnet.com.au
Tue Mar 14 08:59:19 WST 2006
Timothy White wrote:
> Do you have any scripts for doing the compression from SD to mpeg-4,
I have some perl to build up the 'mencoder' command line.
Needs cleaning, but the guts is:
my $mencoder = "/usr/bin/mencoder -ffourcc divx";
my $audio = "-oac mp3lame -lameopts preset=160" ;
my $lavcopts = "autoaspect:vbitrate=$bitrate:keyint=200";
my $filter = "-vf ";
if ( $deinterlace ) { $filter .= "lavcdeint,"; }
if ( $crop eq "n" ) { $crop = "536:572"; } # 'narrow' - 4:3
if ( $scale_square_pixels ) {
$filter .= "scale=:-2 -sws 2 ";
}
my $cmd = "nice time $mencoder $filename -o $basename.avi $audio -ovc
lavc -lavcopts $lavcopts $filter @more_args"; # -sb $start -endpos
$length
> or HD to mpeg-4? If you already have the command line options, I'd
> rather not reinvent the wheel ;-)
The '-ffourcc' is needed for many players.
For HD, I scale down to 720 lines.
You need a larger "-tsprobe" value as the default is too small for hdtv.
#!/usr/bin/perl -w
# © myk 2006
# 1080i mpeg2 -> 720p 25fps mpeg4 AVI.
# No need to deinterlace usually, as source is 24fps film.
use strict;
if ( $#ARGV < 0 ) {
die "usage: $0 <filename> [bitrate [mencoder-args]]\n";
}
my ( $filename, $bitrate, @more_args ) = @ARGV;
if ( !$bitrate ) { $bitrate = 4000 };
$filename =~ /(.*\/)?(.*).(mpe?g|[tp]s)$/ or die "filename '$filename'
lacks mpg/ts/ps extension.";
my $dir = $1;
my $basename = $2;
my $mencoder = "/usr/local/bin/mencoder -ffourcc XVID";
my $lavcopts = "vcodec=mpeg4:vqscale=3:vhq:vbitrate=$bitrate";
my $filter = "-vf crop=1920:1080:0:0,scale=1280:720 -sws 2 $filename";
my $cmd = "nice time $mencoder -oac copy -ovc lavc -lavcopts $lavcopts \
-tsprobe 10000000 $filter -o $basename-720.avi @more_args";
print "Running: $cmd\n";
system $cmd;
Any suggestions?
More information about the plug
mailing list