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
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 .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With