transcode video files into high quality flv (H.264/FAAC) with perl
Thursday, May 6, 2010 8:05:12 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.flv>\n";
exit;
}
# Transcoding input file into a 480x360 flash video, encoded with H.264 and FAAC MPEG-4 codecs!!";
`ffmpeg -y -benchmark -threads 2 -i $input_file -async 1 -deinterlace -croptop 0 -cropbottom 4 -cropleft 8 -cropright 6 -s 480:360 -vcodec libx264 -b 200k -maxrate 960k -bufsize 384k -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 libfaac -ab 64k -ar 22050 $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.flv>\n";
exit;
}
# Transcoding input file into a 480x360 flash video, encoded with H.264 and FAAC MPEG-4 codecs!!";
`ffmpeg -y -benchmark -threads 2 -i $input_file -async 1 -deinterlace -croptop 0 -cropbottom 4 -cropleft 8 -cropright 6 -s 480:360 -vcodec libx264 -b 200k -maxrate 960k -bufsize 384k -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 libfaac -ab 64k -ar 22050 $output_file`;






