Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am new to php. I have installed ffmpeg in my local iis.. Is it possible to generate a thumbnail image for a flv file.? Please help..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
580 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try this

$ffmpeg = 'ffmpeg.exe';

//video dir
$video = 'video.flv';

//where to save the image
$image = 'image.jpg';

//time to take screenshot at
$interval = 5;

//screenshot size
$size = '320x240';

//ffmpeg command
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";       
$return = `$cmd`;

An explanation of the command options:

-i filename (the source video's file path)
-deinterlace (converts interlaced video to non-interlaced form)
-an (audio recording is disabled; we don't need it for thumbnails)
-ss position (input video is decoded and dumped until the timestamp reaches position, our thumbnail's position in seconds)
-f output file format
-t duration (the output file stops writing after duration seconds)
-r fps (sets the frame rate to write at; fps is expressed in Hertz (1/seconds); we use 1 so that we grab only one frame)
-y (overwrites the output file if it already exists)
-s widthxheight (size of the frame in pixels)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...