Using ffmpeg to create a single thumbnail image from a red5 recorded flv file

Below is a simple php code to manipulate with ffmpeg and create a thumbnail image from a recorded flv file. Assuming that we used oflaDemo to record the video and we want the image to be the frame on the 4th second of the video:

<?php

//Set video flv path
$videoFilePath = “/usr/local/red5/webapps/oflaDemo/streams/9.flv”;

//Set Image path
$videoImageFilePath = “/home/username/public_html/test/test.jpg”;

//Set time
$time = ’00:00:04′;

//Execute ffmpeg command
exec(“/usr/local/bin/ffmpeg -i $videoFilePath -an -ss ” . $time . ” -an -r 1 -s qcif -vframes 1 -y $videoImageFilePath “);

?>

Check if exec is enabled on your account, in most of our servers it is disabled, contact support to have it enable in your account, this is done by adding a php.ini file to your account.