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

Haakon Riiser haakon.riiser
Tue May 12 16:23:28 CEST 2009

>> So how do you handle seeking to random locations in the stream?
>> 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?  Can I code audio so
>> that every frame is independent?
> Audio isn't the same as video. In many compression methods (including mp3 and
> AAC) decode of a frame of audio generates more than a frame of output samples -
> some samples at the start are merged with the samples at the tail of the
> previous frame and some samples at the end of the frame will be merged with the
> next frame.  Thus the output samples depend on the previous frame, but you will
> have "good" data from at least the 2nd decoded frame onwards.
> Does that help?  For more detail you are going to need to look at the relevant
> standards (or possibly Wikipedia)

Thanks for the feedback guys.  I worked around the problem by
memsetting the samples from the first two frames after a seek
to zero.  I didn't want to do this at first (it seemed like an
ugly hack), but you've made me feel better about doing it. :-)


More information about the ffmpeg-devel mailing list