[FFmpeg-user] ffprobe -show_frames and coded_picture_number
phil_rhodes at rocketmail.com
Sun Aug 11 18:53:36 CEST 2013
This does come up frequently!
The a/v data in the file may never go out of sync, but the actual hardware is not locked together.
Ideally, you might think you'd get (for instance) 60 refreshes per second out of the graphics card, and (for instance) 48,000 samples per second out of the sound card. But small, entirely normal errors in the crystal oscillators that run the hardware mean that eventually either a frame will be dropped or duplicated, or at least dropped or duplicated in terms of one display refresh. The other, better alternative would be to resample the audio and time the whole playback system to the graphics card's refresh rate, but nobody seems to do that, presumably because resampling audio is hard.
Either way, for this reason, there is no guarantee that even if you display a 30fps video file on a 60Hz display, you will get each frame exactly twice. It's impossible, given the fact that the playback software is (usually) locked to the sound card, and the graphics card is not locked to the sound card. As a practical matter, even now it's quite feasible that variabilities in system load and interrupt handling will cause further glitches beyond that intrinsic problem. It can be quite difficult to get modern computers to do things to within a sixtieth of a second.
This means that it is strictly impossible to do critical motion rendering evaluation on a computer monitor with common software, and it is why people like Blackmagic make integrated video playback boards, with both sound and video hardware on one card, clocked from the same crystal and thus in perfect sync.
More information about the ffmpeg-user