[FFmpeg-devel] About Unchanged Frames

Måns Rullgård mans
Sun May 11 13:30:09 CEST 2008

Mike Melanson <mike at multimedia.cx> writes:

> Michael Niedermayer wrote:
>> On Fri, May 09, 2008 at 11:42:01PM -0700, Mike Melanson wrote:
>>> Hi,
>>> The type of material I am trying to encode with ZMBV has a lot of 
>>> unchanged frames. It seems that the best ZMBV can do with unchanged 
>>> frames is 11-12 bytes. I seem to recall that it's possible to stuff an 
>>> AVI file with an empty frame (i.e., a '00dc' chunk with a 0-length 
>>> payload) that the demuxer will interpret as an empty frame (I have some 
>>> H.264 AVI files that do this). How can an encoder communicate to FFmpeg 
>>> that the AVI muxer should mux a 0-length frame? When I try to return 0 
>>> from the encode_frame() function, FFmpeg construes that as a skipped 
>>> frame and doesn't mux it.
>> The avi muxer will add 0 frames as needed depending on dts.
>> Anyway try skip_threshold,
>> if it works (with mpeg4) then your code is buggy
>> if it doesnt then mine is :)
> This gave me a little to work with, although they seem unrelated (dts 
> and skip threshold). I see there is an option called -skip_threshold and 
> a few associated options and that mpegvideo_enc.c cares about them. So I 
> can see how the parameters for comparing the current frame with the 
> previous can be tweaked. But I still don't see how an encoder can 
> communicate to the muxer that a frame is unchanged and that it's safe to 
> mux an empty frame.

Suppose you have video with a nominal framerate of 25 fps, or put
differently, a frame period of 40 ms.  If you want to skip one frame,
simply increase the PTS/DTS by 80 ms instead of the usual 40 for the
following frame.  Sensible containers with timestamps will just work,
and an AVI muxer can insert a dummy frame to account for the missing

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list