[Libav-user] avcodec_flush_buffers on looping

Moises Ferrer Serra mferrer at brainstorm.es
Mon Sep 3 13:11:58 CEST 2012


Hello,

I have a working implementation of clip playback with ffmpeg, but I am 
finding some problems with looping. The documentation states that 
avcodec_flush_buffers should be called when seeking, but I was wondering 
if that was strictly necessary for loops. Not flushig on loops leads the 
program to output all the images, provided that I add a dumy packet at 
the end of the last loop for some clips. However, the reported DTS and 
PTS are not what I would expect (ie. decoding the firts packet after 
looping brings me the last image of the previous iteration, but PTS and 
DTS of the new packet).

My question is if the way to go would be to flush always, at the end of 
the loop, adding any dummy packets if needed. Note that loop does not 
need to be full clip lenth, it is arbitrary (in case that makes a 
difference).

Thanks!


More information about the Libav-user mailing list