Using FFMPEG to get screenshot video shot pictures from a flash video flv file

FFMPEG Command via php to convert FLV videos to JPEG video screen shots
You must have FFMPEG installed on your linux box.
You must put the videos in the directory your run the script below in.
You must have a subdirectory /videoshots as well.
$dir would be the directory the videos are in
$files[$i] would be the list of video files in an array where $i would start at 0 I suppose.

/*Excerpt from Risharde's Video to JPG PHP script on Wordoflifefaithcentre.com*/

$cmd = "/usr/local/bin/ffmpeg -i " . $dir . $files[$i] . " -r 1 -t 00:00:30 -f mjpeg -s 200x150 -qscale 20 ";
$cmd = $cmd . $dir . "videoshots/" . $filepath[0] . '-1.jpg 2>&1';
system($cmd);

The command can be done in one line but since I use nano to edit files in linux, I decided to split the command so I could understand the code better.

Basically, FFMPEG from wha I gather requires an input file
Thus, we generally always start with
/usr/local/bin/ffmpeg -i

-i stands for the input file also known as the source file which you will always need to supply.

Next
-r 1 is saying we just want 1 image file to be generated

Next
-t xx:xx:xx tells ffmpeg where to get the photo/screenshot/videoshot from the video

Next
-f mjpeg is telling ffmpeg to convert to the mjpeg (JPEG) output format (photo format for those none technical folks out there)

Next
-s WIDTHxHEIGHT is obviously the width and height of the generated jpeg file

Next
-qscale 20 is the QUALITY SCALE. The higher you go, the lesser the quality of jpeg image generated and probably the smaller the jpg file becomes.

Next
Lastly, the path and name of the jpg image to be output

So it looks a little bit technical, but hopefully with this one page crash course, you can do what I did to get video screen shots :)

Good luck,
Drop me a line via the Contact Risharde link in the Menu if this helped you
Take it slight in your doubles (a delicacy in Trinidad and Tobago)

--Risharde