[Libav-user] ffmpeg resize
nicolas.george at normalesup.org
Wed Jul 17 00:35:36 CEST 2013
L'octidi 28 messidor, an CCXXI, rad bogdan a écrit :
> Hi everyone,
> I intend to use libav* for an embedded project in order to generate
> thumbnails for common image formats ( jpg, bmp, png, gif, tiff ).
> I know that ffmpeg is designated for processing mostly video/audio
> files but I chose it because in my case the libraries are approximately of
> 1.4MB ( the build was configured only with the necessary components )
> and because of the possibility to use custom read/write/seek functions.
> The problem I'm facing now is about the processing speed.
> I have a dataset of 20 jpeg files aprox 300KB each and the time it
> takes for a bash script to call for 20 times "ffmpeg -i .. -s.. .. " is
> of 26 seconds ( 700MHz CPU ) while with enlightenment library it takes
> 6 seconds. Most of the time is spent in output_packet() function in ffmpeg.
> Is there any chance that by implementing my custom resize application
> using libav* I'll improve the processing speed to be close to 6
> seconds ? I'm not used yet with the API and your response could save
> several days of needless work.
I believe so. Most of the time is spent in the library and application
initialization, options parsing, format probing, information dump, etc. The
actual processing is very fast: remember it is designed for video, it needs
to be able to process frames in real time.
You can get an idea by running a single ffmpeg command to process a bunch of
images: you need the images to all have the same source and target size and
be numbered in a logical way. I just ran the test and it went from
29 seconds to 4.6, for 100 images. Loading images in different formats and
scaling from/to different sizes will take a little more time, but not much.
If you write a small clean app to resize and convert a bunch of images, it
could be even considered to be adopted as an example or an extra tool.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the Libav-user