[Libav-user] Updated libav/ffmpeg tutorial

Stephen Dranger dranger at gmail.com
Mon Feb 23 17:41:06 CET 2015

Sorry, the reference to packet->dts is an oversight on my part in changing
the code. To more closely match ffplay.c I'll update it to be:

 if((pts = av_frame_get_best_effort_timestamp(pFrame))  == AV_NOPTS_VALUE) {
   pts = 0;

Later on in the code, if pts is 0, the player will simply set the pts to an
external clock, which isn't the best, but it doesn't cover dropping frames,
and it's what ffplay used to do. Is there a better option that is a simple

I'm getting too much credit if people think I came up with any of this
syncing code; all of it is based off of the ffplay.c source from 2007. The
only work I did is trying to explain it to people. It definitely needs to
be updated, but hopefully all the incorrect information is gone.

On Mon, Feb 23, 2015 at 5:31 AM, wm4 <nfxjfg at googlemail.com> wrote:

> On Mon, 23 Feb 2015 13:51:33 +0300
> Max Vlasov <max.vlasov at gmail.com> wrote:
> > Frankly, I thought that all alternatives should be considered _after_
> > av_frame_get_best_effort_timestamp returned  AV_NOPTS_VALUE. At least the
> > name suggests so. Both Stephen and ffmplay versions checks for some prior
> > knowledge before even trying this function. Imho, If all heuristics is
> > inside av_frame_get_best_effort_timestamp and better and better from
> > version to version, this will be "best bet" for everyone. If single frame
> > is not enough  then this function might require the last packet or
> > something like this, but moving all the complexity inside it will remove
> > large part of confusion
> The heuristic in av_frame_get_best_effort_timestamp() is pretty weak,
> and the function doesn't exist in Libav, so you don't have to use it.
> It's really just a helper.
> For someone inexperienced, it will probably work much better than
> whatever he could come up, though. The FFmpeg function also falls back
> to DTS, and tries to resolve "strange" issues (like timestamps going
> backwards). So there's no reason not to suggest using it, and also
> there's no reason to try to fall back to DTS yourself.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150223/43f02b1c/attachment.html>

More information about the Libav-user mailing list