[MPlayer-dev-eng] [PATCH] v4l2 interface

Martin Olschewski olschewski at zpr.uni-koeln.de
Tue Jan 14 19:15:50 CET 2003


On Mon, Jan 13, 2003 at 06:09:22PM +0100, Jindrich Makovicka wrote:
> There's a well known problem that the timestamps of the video stream and 
> sample counts are related to different timebases. It took me a while to 
> make the a/v sync work and it required a lot of tedious hacking (see the 
> *skew* stuff in tvi_v4l.c). If tvi_v4l2 isn't still capable to do 
> internal a/v sync, it has to be compensated for in mencoder. tvi_v4l2 
> corrects the video timestamps by the difference between theoretical and 
> real audio sample count. On my hardware the difference does about 1s pes 
> hour so it's not negligible.
Even after a deep look in tvi_v4l.c I still do not understand all the
details.  As far as I understand the sample counts of the audio stream
are related to an internal clock of the audio device, which may drift
from the system clock, one second per hour in your case.  If this does
not get compensated a/v sync gets lost obviously.  So it would be
better to use timestamps from the system clock on audio frames too,
like video frames, but if the audio device is to fast I have to buffer
more and more audio frames, if it is to slow, I run dry.  Ok?

What I am still missing is the principal solution.  Drop audio/video
frames that does not have a matching partner?

I will try to add something like this to v4l2 (hopefully I can use
parts from v4l) but I think I have to fully undestand the problem and
it's solution first.  Until now I have not found any documentation
about this.

Thanks for your support,

  Martin

-- 
Dipl.-Inform. Martin Olschewski 	Center for Applied Computer Science
Email: olschewski at zpr.uni-koeln.de	University of Cologne
Tel.:  ++49/221/470-6018		Weyertal 80
Fax.:  ++49/221/470-5160		D-50931 K\"oln


More information about the MPlayer-dev-eng mailing list