[FFmpeg-devel] ffmpeg & static & state

Denis Otchenashko denis
Mon Oct 8 16:47:29 CEST 2007

Hi everybody

We have a problem on repeatitive  video encodings within one process.
First encoding passes OK but all the next fails because of incorrect state
inside ffmpeg library.

We are working on video recognition system and it is necessary to have some
kind of decoding/encoding library inside our engine.
It shall work without interrupting and exiting a process after each video.
So it needs to decode/encode batch of files/streams without exiting a
process in one endless cycle.

We have taken ffmpeg.c code as a base and substituted a main function body
with facade.
The difference between main function and this facade is the last one
processes a number of "command lines"
The first command line is succesfully processed, but the next one is not.

After reviewing ffmpeg code we noticed a lot of static variables which
accumulates state between functions' calls.
These statics are present in codecs and others parts. It works for the first
iteration, but the state accumulated in the
 first decoding/encoding iteration  does not  allow  to  make  the
second/next iteration properly.

We need to work out this problem in clean way.
We already tried some weird fixes to it but we look for a clean solution.
Could somebody advise on this issue?
Is anybody else interested in?
Are there any plans to get rid of statics?
Is it possible in current design to reset all static variables(states) using
a unified way from one point?
It seems no. Have we missed something?
We would appreciate the solution if it exists.

Denis  Otchenashko

Senior Software Engineer
mob: +38050 356 74 19

More information about the ffmpeg-devel mailing list