transcode video files into H.264/MP3 AVI with perl
Thursday, May 6, 2010 8:32:26 AM
#!/usr/bin/perl
# Require ffmpeg & libavformat, libavcodec extra packages installed!!
use strict;
my $input_file=$ARGV[0];
my $output_file=$ARGV[1];
if (!$ARGV[1]) {
print "*** Usage: ./ffmpeg.pl <input_file> <output_file.avi>\n";
exit;
}
# Transcoding input file into a 720x480 MPEG-4 video, encoded with H.264 and MP3 codecs!!";
`ffmpeg -y -benchmark -threads 2 -i $input_file -async 1 -deinterlace -s 720:480 -vcodec libx264 -b 1500k -maxrate 1500k -bufsize 500k -coder 1 -level 13 -flags +loop -cmp +chroma -trellis 2 -bidir_refine 1 -refs 3 -b_strategy 1 -directpred 2 -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 4:3 -acodec libmp3lame -ab 128k -ar 48000 $output_file`;
# Require ffmpeg & libavformat, libavcodec extra packages installed!!
use strict;
my $input_file=$ARGV[0];
my $output_file=$ARGV[1];
if (!$ARGV[1]) {
print "*** Usage: ./ffmpeg.pl <input_file> <output_file.avi>\n";
exit;
}
# Transcoding input file into a 720x480 MPEG-4 video, encoded with H.264 and MP3 codecs!!";
`ffmpeg -y -benchmark -threads 2 -i $input_file -async 1 -deinterlace -s 720:480 -vcodec libx264 -b 1500k -maxrate 1500k -bufsize 500k -coder 1 -level 13 -flags +loop -cmp +chroma -trellis 2 -bidir_refine 1 -refs 3 -b_strategy 1 -directpred 2 -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 4:3 -acodec libmp3lame -ab 128k -ar 48000 $output_file`;






