[FFmpeg-devel] [PATCH] ffmpeg: implement -force_key_frames_expr option

Stefano Sabatini stefasab at gmail.com
Fri Dec 14 18:02:11 CET 2012

On date Friday 2012-12-14 03:15:22 +0100, Michael Niedermayer encoded:
> On Fri, Dec 14, 2012 at 12:56:42AM +0100, Stefano Sabatini wrote:
> > +The expression in @var{expr} can contain the following constants:
> > + at table @option
> > + at item n
> > +the number of already forced keyframes
> > + at item prev_t
> > +the time of the last forced key frame, it is @code{NAN} when no
> > +keyframe was forced yet
> > + at end table
> implementing this in ffmpeg.c makes the expression evaluation only
> available to ffmpeg and not to other user applications, also the
> expression evaluator only has a small number of input variables
> available from the application.

> in libavcodec it would have a much larger amount of information
> available, like the scene change score or various rate control
> parameters

The idea is interesting. How do you want it to be implemented? This
patch only computes the next value to force when the current frame is
forced, an alternative could be to evaluate an expression (say:
"gte(t, n*10-0.05)") at each frame (slower but more flexible).

Another interesting idea would be to get values from a file (e.g. to
specify a list of values), something like:

but this can be implemented later.
FFmpeg = Fascinating and Formidable Magnificient Powered Emblematic God

More information about the ffmpeg-devel mailing list