[Libav-user] Knowing the wait time between each frame display

wm4 nfxjfg at googlemail.com
Sat Jul 19 18:59:46 CEST 2014


On Mon, 14 Jul 2014 17:54:20 -0700
Michael Albanese <mja266 at nau.edu> wrote:

> I'm currently messing around with the ffmpeg API, more specifically, I've
> been looking at ffmpeg's filtering_video.c example + the updated dranger
> tutorial02.c which rapidly pushes decoded video frames to an SDL instance.
> 
> I'm trying to modify dranger's tutorial02 in order to playback frames at
> the rate which they are meant to be played, I've tried the following:
> 
> - (Close, but too slow / fast) Getting the FPS, sleeping calculated_delay -
> processing time
> - (Too fast) Delaying the video as shown in the filtering_video.c example
> 
> I've been looking into how dranger was accomplishing it in tutorial05
> <http://dranger.com/ffmpeg/tutorial05.html>, he appears to be using the pts
> / dts in order to calculate the delay, however the overridden
> AVCodecContext get_buffer and release_buffer pointers seem to be
> depreciated.
> 
> Since the up to date version of his tutorial05 found here
> <https://github.com/chelyaev/ffmpeg-tutorial> does not synchronize properly
> either (comparing against ffplay)... is anyone willing to point me in the
> right direction (or write an up to date tutorial on playing back video +
> audio at the correct rates).

IMO the only reliable way is to decode 1 frame in advance, and take the
difference between the PTS values. Of course this doesn't work either
if there is a PTS reset, but these are very rare.


More information about the Libav-user mailing list