Great. Thanks a lot for the advice. --Tom ----- Original Message ----- From: "Andrew Stevens" <Andrew.Stevens@xxxxxxxxxxxxxxx> To: <video4linux-list@xxxxxxxxxx> Sent: Thursday, February 08, 2001 7:57 AM Subject: Re: How to get good audio / video sync? > Hi, > > > I am starting to write a v4l capture aplication and one of my goals is > > good audio / video sync. I was wondering is anyone can give me some > > pointers on the bast way to do this. > > From looking at other programs, I have gathered that I should make the > > app multithreaded, with a video capture, audio capture, controlling, and > > file writing thread. I would also like to take advantage of large buffers > > since ram is so cheap these days. Other than that, I am pretty much in the > > dark as how to get good a/v sync. > > One method is to use the audio stream as your timebase. You can > reconstruct pretty accurate time stamp info for the time an audio buffer > was filled using the OSS ioctl's. Basically, you look up the real-time > time clock for "now" and do an ioctl to tell you how many bytes have > been captured since "now" and when the sync was triggered. Calculated > backwards from the card's data-rate and you have a nice precise > time-stamp. > > You then duplicate/drop frames as necessary to keep the frames you're > captured correct relative to the length of audio stream you have > captured. > > Doing it the other way around is much harder as a single dropped/dupped > frame is hard to notice but a gap or repetition in audio sounds > horrible. > > > Andrew > > > > > Thanks in advance, > > --Thomas > > > > BTW: This message might get duplicated. I aplologize in advance. > > > > _______________________________________________ > > Video4linux-list mailing list > > Video4linux-list@xxxxxxxxxx > > https://listman.redhat.com/mailman/listinfo/video4linux-list > > > > _______________________________________________ > Video4linux-list mailing list > Video4linux-list@xxxxxxxxxx > https://listman.redhat.com/mailman/listinfo/video4linux-list >