Need help about ffmpeg for creating and showing thumbnail of a video

Hi,

I want to create thumbnail from uploaded video in the website using ffmpeg and show the uploaded video from the front end of the site after creating thumbnail.How can i do this? Is it possible to create thumbnail during upload video in the website? Is there anyone can help me explain me this by example?

Thanks,
Rima.

You cannot do this during upload, however, after upload you can create a thumbnail.
You’ll need to run this on the command line:


ffmpeg  -itsoffset -4  -i uploaded_movie.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 thumbnail.jpg

From PHP, after uploading and saving the file:



$output_file_name = '/var/www/your_site/images/thumbnail.jpg';

$cmd = 'ffmpeg  -itsoffset -4  -i ' . $path_to_uploaded_file. ' -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 ' . $output_file_name;

Thanks Immerse.

But can you please tell me which variable i will use to show the image? Please see the following code. In poster attribute which variable i have to pass?

<video src=“Media/<?=$row[‘videofile’]?>” height=“370” id=“container” poster=“images/<?=$cmd?>” width=“590”> </video>