Page 1 of 1

Capture webcam/Record: sound out of synch - any fix?

Posted: 26 Dec 2010 08:17
by owlbrudder
Running VLC 1.1.5 on Fedora 14.
If I capture input from my webcam and then press the record button, sound starts off synchronised but slowly drifts out of synch. By the time the capture has lasted a couple of minutes, the difference between sound and vision, with sound leading, is about a second. Is there any way to correct a drift like this? I know I can change the start time of sound relative to vision, but that would not correct the progressive drift I am seeing.

Re: Capture webcam/Record: sound out of synch - any fix?

Posted: 26 Dec 2010 13:34
by Jean-Baptiste Kempf
You need to transcode and maybe use audio-sync option.

Re: Capture webcam/Record: sound out of synch - any fix?

Posted: 26 Dec 2010 15:45
by Greg
Problem seems to be related to v4l2 and ALSA?
See
http://trac.videolan.org/vlc/ticket/4280

http://trac.videolan.org/vlc/ticket/4315#comment:2

https://bugs.launchpad.net/ubuntu/+sour ... bug/686248

VLC 1.0.6 does not seem to have the problem, or at least not to the same degree, which is odd if the problem is due to alsa v4l2?

Do or did you see the problem in Fedora/VLC 1.0.6?

Perhaps raise a bug on Fedora as well

Re: Capture webcam/Record: sound out of synch - any fix?

Posted: 27 Dec 2010 00:51
by owlbrudder
Ah, ha! Greg, the first link you provided gave the answer:
I am afraid this cannot be solved. OSS (or ALSA) and V4L2 drivers would have to provide consistent timestamps to VLC, which they don't. So VLC is left to best guess based on time of dequeuing the data. Obviously, this is imprecise.
I expect the solution is to use an external recorder for video, rather than try to capture clips using the webcam. A minor pity, really, but I am glad to have found the answer why it is not working for me.

Thank you for your time.

Re: Capture webcam/Record: sound out of synch - any fix?

Posted: 29 Dec 2010 10:09
by owlbrudder
As described in my final post to http://www.linuxquestions.org/questions ... ok-850321/, I found allowing real-time priority improved synchronisation. I don't know if that actually made the difference, but I am now getting results suitable for my purposes. Suitable, but not perfect. VLC is producing results far better than any of the other tools I tried, including ffmpeg. I expect I could get ffmpeg to do a good job, if I had the time to study it in detail.

Hope that helps any lurkers. Happy New Year all.

Re: Capture webcam/Record: sound out of synch - any fix?

Posted: 29 Dec 2010 21:50
by Greg
The responses from trac-VLC developers suggest the problem is rooted in v4l2 - ALSA.
Given that.....

The audio sync symptoms may apparently be lessened by various techniques, but the root cause remains. Streaming for any length of time still seems to result in lip sync drift.

Reporting the bug or problem back via your distro or indeed upstream to v4l2, ALSA, etc may help to highlight the issue and focus some attention on solving the cause.

Happy New Year

Re: Capture webcam/Record: sound out of synch - any fix?

Posted: 02 Jan 2011 06:26
by owlbrudder
the root cause remains
Yep, the root cause was my mistake. At one stage, I had set up a 40ms sound delay and forgot to clear the setting. :oops:
Using out-of-the-box VLC settings, I can now record synchronised sound and video from my webcam using the Capture Device and the record button. Doesn't get much easier than that.