[FFmpeg-devel] looping input and pts rollover

Andrey Utkin andrey.krieger.utkin at gmail.com
Thu May 24 00:00:09 CEST 2012


2012/5/24 Robert Nagy <ronag89 at gmail.com>:
> Andrey, I'm not sure what you suggest would work since your solution
> seems to assume that video and audio is synced directly out of the
> demuxer, which isn't always the case. Also how would cases where
> "(total_audio_samples) % (audio_samples_per_frame * total_frames) !=
> 0" work when looping?

Valid points. Yep, my suggestion fixes sync on frame-scale
approximation, not on the scale of single samples. The average pts
delta trick is even more far from being perfectly precise. But in my
practice it looked good.
This is very interesting issue.
With respect to points you gave, i see no other possibility than
managing it on application level, and aligning all AVStreams to same
pts after discontinuity detection. This may be padding audio with
silence, padding video with black frames or by duplicating last frame,
or cutting off "spare" frames from the queue of stream which has last
pts higher than others, thus again aligning all streams to same pts.

-- 
Andrey Utkin


More information about the ffmpeg-devel mailing list