[FFmpeg-user] FFMPEG Seeking brings audio artifacts
gabrielsimoes at rocketmail.com
Sat Nov 5 18:23:48 CET 2011
I´m implementing a audio decoder using ffmpeg.
While reading audio and even seeking already works, I can´t figure out a way to clear the buffers after seeking so I have no artifacts when the app starts reading audio right after seeking.
avcodec_flush_buffers doesn´t seem to have any effect on the internal buffers. This issue happens with all decoders (mp3, aac, wma, ...) but PCM/WAV (which doesn´t use internal buffers to hold data to decode since the audio is not compressed).
The code snippet is simple:
av_seek_frame(audioFilePack->avContext, audioFilePack->stream, posInTimeFrame, AVSEEK_FLAG_ANY);
audioFilePack->avContext = FormatContext
audioFilePack->stream = Stream Position (also used to read audio packets)
audioFilePack->avContext->streams[audioFilePack->stream]->codec = CodecContext for the codec used
Any ideas on what I should do so I can seek and get no residual audio?
Question was also submitted to StackOverflow but I have got no answers until now:
More information about the ffmpeg-user