[FFmpeg-devel] Decoding the same audio frame twice produces different output

Benjamin Larsson banan
Tue May 12 15:29:04 CEST 2009

Haakon Riiser wrote:
>> Haakon Riiser wrote:
>>> As the subject states, I am wondering why libavcodec produces
>>> different output when the same audio frame is decoded twice in a
>>> row.  As far as I know, every audio frame is as independent as an
>>> I-frame in video, so it should always produce the same output.
>> Most codec frames are dependent on the previous frame thus your  
>> statement is false.
> So how do you handle seeking to random locations in the stream?

It's a case by case situation, some codecs depend on more then one frame 
(up to 16 IIRC). So what you can do is decode a few frames that you 
don't use. In that case you wouldn't get any artifacts.

> I sometimes get horribly loud artifacts when seeking, which is why
> I'm investigating this problem.  Are some audio frames the
> equivalent of key frames in video?

Might be in some codecs.

>   Can I code audio so that every
> frame is independent?

Yes use the pcm codec.

Benjamin Larsson

More information about the ffmpeg-devel mailing list