[Ffmpeg-devel] refactoring ffmpeg.c forsharedlibrarycompatibility.

Víctor Paesa wzrlpy
Sun Dec 17 23:00:52 CET 2006

> V?ctor Paesa <wzrlpy at arsystel.com> writes:
>> Hi,
>>> V?ctor Paesa <wzrlpy at arsystel.com> writes:
>>>> Hi,
>>>>> Hi
>>>>> On Sun, Dec 17, 2006 at 06:48:20PM +0800, Jaime V. wrote:
>>>>>> Hi,
>>>>>> I'd like to refactorize ffmpeg.c in order to write a function to
>>>>>> initialize and teardown variables in it and need some help for it.
>>>>>> I willing to undertake the deed and maybe it can contribute this way
>>>>>> to
>>>>>> the project. :)
>>>>>> Frustrated by the common beginners difficulty of trying to use
>>>>>> ffmpeg
>>>>>> in
>>>>>> a project to transcode some videos i came up with the idea of using
>>>>>> the
>>>>>> already implemented ffmpeg.c as a library. This makes it easier for
>>>>>> beginners to use ffmpeg from within existing projects or foreign
>>>>>> environments such as MSVC. This also comes in handy when using own
>>>>>> protocols.
>>>>> exec("ffmpeg(.exe)", ...)
>>>> There two advantages on this proposal:
>>>> a) Spawning processes is slower that using this high level library,
>>> I can't imagine a situation where that overhead would be significant
>>> at all.
>> Is not significant if you're transcoding (tipically) large multimedia
>> files, but imagine a file open dialog that has got a file preview/file
>> codec
>> info window. In this case as soon as you click on a filename it needs to
>> launch ffmpeg to get that thumbnail/info, and the time is noticeable.
> Really?  And how much this time is due to fork overhead, and how much
> is from actual processing?

I prepared 500 images (JPG), actual processing is the same in both
scenarios, but scenario A takes a lot more time to run due to spawning 500

time for i in img???.jpg
  ffmpeg -f image2 -i ${i} -f image2 out${i}

real    0m40.141s
user    0m26.421s
sys     0m19.009s

time ffmpeg -f image2 -i img%03d.jpg -f image2 outimg%03d.jpg

real    0m4.522s
user    0m3.858s
sys     0m0.452s

The CPU is a P4-D830, I must say that Cygwin is particulary bad at
forking, so YMMV.


More information about the ffmpeg-devel mailing list