perl script to post-process files created by red5

Converts movie_name.flv to movie_name.mp4 with AAC audio, H.264 video. Extracts a thumbnail jpg, too


#!/usr/bin/perl
$ENV{LD_LIBRARY_PATH} ='/usr/local/lib/';

$movie_name=shift @ARGV;
$old_movie_name = $movie_name.".flv";
$new_movie_name = $movie_name.".mp4";
$toe_name = $movie_name.".jpg";

my $range = 100000;
my $random_number = int(rand($range));
$temp_movie_name="/tmp/$random_number.mp4";
$make_mpeg=`/usr/local/bin/ffmpeg -y -i $old_movie_name -acodec libfaac -ab 96k -ar 44100 -vcodec libx264 -vpre hq -crf 22 -flags2 -bpyramid $resize $temp_movie_name`;
$test=`/usr/local/bin/ffmpeg -y -i $temp_movie_name -f image2 -ss 15 -vframes 1 -s "360x270" $toe_name 2>&1`;
$last=`/usr/local/bin/qt-faststart $temp_movie_name $new_movie_name`;

About Wesley Wright

Born on a mountain top near New York City, Craziest state in the land of the pretty. Raised in the woods so's he knew every tree, Killed him a bear when he was only three.
This entry was posted in Projects, Scripts - Programming, Systems and Servers, Video and Audio. Bookmark the permalink.