Faster Thumbnail/Image Extraction from Video using FFMPEG?

I am using this command to extract a series of images from a video to express them as a visual time-frame of the video.

ffmpeg -i inputfile.mp4 -r 1 -t 12 image-%d.jpeg

Most of my videos are in mp4 format. I am able to extract the images successfully but the time taken for extraction is too long.

Is there any way I could reduce the time for image extraction ?

EDIT: It is taking me 60 secs to get 8 thumbnails from a 15 sec long video encoded in MP4 format, I am doing this operation on my Galaxy Nexus(Android Phone) is there any way to improve the speed of operation, ideally I want it be less than ~10secs.

Answers


Hm, define "slow" :) I just did this and it took four seconds on a standard machine. There might be ways to speed that up, but ffmpeg has to decode the MP4 packet structure (GOP), extract the frame and store the JPG image - four seconds looks reasonable to me. I just see little room for improvement in your command-line:

ffmpeg -i inputfile.mp4 -r 1 -an -t 12 -s 512x288 -vsync 1 -threads 4 image-%d.jpeg

Play around with the threads and -s parameter (this one defines the target image size - it will not speed up the process, but if you don't want to keep the source image size it will save you an additional step).

Also, make sure that you have an ffmpeg build that matches your platform - there are great differences in speed there. Unfortunately, I can't give you a general advice here. For your scenario it may be an idea to compile the ffmpeg sources yourself.


Here https://stackoverflow.com/a/18539500/2563051 is drama for this :))

The -ss parameter needs to be specified before -i:

ffmpeg -ss 00:03:00 -i Underworld.Awakening.avi -frames:v 1 out1.jpg

This example will produce one image frame (out1.jpg) somewhere around the third minute from the beginning of the movie. The input will be parsed using keyframes, which is very fast. The drawback is that it will also finish the seeking at some keyframe, not necessarily located at specified time (00:03:00), so the seeking will not be as accurate as expected.


Need Your Help

represent xml as java classes

java xml

Probably this question might have been asked. I am new to the conversion of xml to java classes.

DataTables numbers_length = 3 change pagination buttons

jquery pagination datatables

By setting the numbers_length property to 3, I am able to produced this