[FFmpeg-devel] [QUESTION] Proper handling and reporting of decoding errors

Michael Niedermayer michaelni at gmx.at
Fri Jun 10 01:45:36 CEST 2011

On Fri, Jun 10, 2011 at 12:36:50AM +0200, Maxim wrote:
> Hi crews,
> I would gladly understand how FFmpeg/libav handles decoding errors. I
> need that information in order to implement proper error handling in my
> indeo decoders.
> case 1: my decoder encounters a broken P-frame. That usually means that
> all following frames until the next key one will be broken as well. The
> proper reaction would be to wait for the key frame.
> What kind of signal does the calling library expect in this case? Error
> code/empty frame?
> Should I introduce some kind "need_resync" flag in the decoder and skip
> broken frames internally or is there any possibility to report broken
> frames to the caller?

if you encounter a broken P frame the best thing is generally to do a
best effort error concealment and continue.
there are error_concealment/resilience variables that tune this.
displaying the same frame until the next keyframe is likely not the
best choice but i dunno indeo internals.

> case 2: indeo codecs uses sometimes so-called "sync"-frames. The frame
> data just contain a short header (16 bytes) indicating that nothing has
> changed. I guess that feature or hack was introduced in order to enable
> variable frame rate which isn't otherwise provided in the AVI container.

avi allows zero byte frames that cause duplication in th player

> Returning previous frame and reporting number of consumed bytes should
> be fine in that case, shouldn't it?
> Would it introduce duplicated frames?

try returing nothing (no frame available that is)

> case 3: temporal scalability. Indeo serie of codecs uses a special kind
> of P-frames whose can be easily dropped without damaging the whole video
> sequence. What kind of signal will be send to decoder in order to
> request frame dropping? The "avctx->hurry_up" flag I used in the
> previous version of my indeo3 decoder is deprecated meanwhile...

see  enum AVDiscard skip_frame

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110610/a4ce5ead/attachment.asc>

More information about the ffmpeg-devel mailing list