[Libav-user] avcodec_flush_buffers on looping

Michael Niedermayer michaelni at gmx.at
Tue Sep 4 23:44:55 CEST 2012


On Mon, Sep 03, 2012 at 01:11:58PM +0200, Moises Ferrer Serra wrote:
> 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).

possibly you are missing: avcodec_decode_video2 doxy
 * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
 * between input and output, these need to be fed with avpkt->data=NULL,
 * avpkt->size=0 at the end to return the remaining frames.


> 
> 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).

flush is recommanded

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/libav-user/attachments/20120904/3f5e9280/attachment.asc>


More information about the Libav-user mailing list