[FFmpeg-devel] Modified force_key_frames option to accept frame numbers

Nicolas George george at nsup.org
Sun Nov 23 20:07:11 CET 2014

Sorry for the late answer, busy weeks.

Le sextidi 26 brumaire, an CCXXIII, Sylvester Zaluga a écrit :
> You are right, this should probably work, although, in use cases like mine
> (when the key frames have to be inserted at exact indexes, not times, in multiple videos), 
> I still find it more natural and practical to just use frame numbers 
> (because all the frame time transformations you describe essentially boil down to 
> doing exactly that).

I do not think so. Basically, you want to synchronize several streams
together, and timestamps are what is used for that. Frame numbers are just
an obvious but clumsy way of encoding the timestamp.

> You are right, in such cases working with timestamps makes more sense.
> Obviously different scenarios require different approaches. In my case I need
> to generate multiple videos of different quality, but with the same number of
> key frames at the same indexes (hence I would avoid the decimate filter).

If I understand your explanations correctly, you need the key frames at the
same place in the stream, i.e. at the same TIME. The fact that the same time
corresponds to the same frame number is just chance, because you use very
similar settings, a fragile assumption.

(And as a side note, that assumption also makes it easy to make the rounding
for the timestamps robust.)

In fact, I do not remember having encountered a single occurrence where
frame numbers were convincingly better than timestamps for anything.

> I am aware of that. I am letting ffmpeg decide where to put key frames in
> the first video, and only force key frames in lower resolution videos, at
> the same indices as in the first one (so I am not forcing too many of
> them, I believe).

You are forcing ALL of them, if I read your mail correctly. This can have
dramatic effect even if the frames would have been key frames anyway.

> Nicolas, you replied earlier that you would not oppose the feature described
> below. Does that mean I can go ahead and submit my change? Can I consider my
> change reviewed or am I supposed to wait for further reviews?

I stick to my announcement: I will not oppose the change based on
principles. Other have expressed advice on the technical merits of the
patch, and I believe their review was quite right.

In the meantime, I hope to convince that it is not needed, and possibly
harmful (because if it is there, other people will use it without realizing
this is wrong for their use case).


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141123/fb29d045/attachment.asc>

More information about the ffmpeg-devel mailing list