Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create thumbnail from video using ffmpeg

Tags:

I need to create a thumbnail from video while uploading it to CDN.

I have been searching for this found this but I am not able to get the screen shot even after following steps.

I am using jwplayer for playing video

Can someone help me to create thumbnail while uploading video using ffmpeg

like image 378
Hitesh Avatar asked Nov 26 '14 09:11

Hitesh


People also ask

How do I extract a frame from a video using ffmpeg?

Use the FFmpeg executable with the seek option. You'll need to convert to a time first, e.g. if I want frame 150 and my video is 29.97 FPS the command will be ffmpeg -ss 00:00:05.01 -i myvideo. avi -frames:v 1 myimage. jpg .


1 Answers

I do not know a way to make a screenshot WHILE uploading, but I do know how to do it after.

The simplest code is:

ffmpeg -i input.mp4 -ss 00:00:01.000 -vframes 1 output.png 

Run this script after you have uploaded the file. It should take only a short amount of time if the screenshot is taken in the beginning of the video. (first minute e.g.).

I do not think it is possible to take a screenshot while the file is still being uploaded.

Edit: removed -f image2 as it is guessed correct by ffmpeg

like image 80
drumkruk Avatar answered Oct 14 '22 04:10

drumkruk