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

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
owlbrudder
New Cone
New Cone
Posts: 9
Joined: 16 Dec 2010 07:49

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

Postby owlbrudder » 26 Dec 2010 08:17

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.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

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

Postby Jean-Baptiste Kempf » 26 Dec 2010 13:34

You need to transcode and maybe use audio-sync option.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

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

Postby Greg » 26 Dec 2010 15:45

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

owlbrudder
New Cone
New Cone
Posts: 9
Joined: 16 Dec 2010 07:49

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

Postby owlbrudder » 27 Dec 2010 00:51

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.

owlbrudder
New Cone
New Cone
Posts: 9
Joined: 16 Dec 2010 07:49

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

Postby owlbrudder » 29 Dec 2010 10:09

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.

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

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

Postby Greg » 29 Dec 2010 21:50

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

owlbrudder
New Cone
New Cone
Posts: 9
Joined: 16 Dec 2010 07:49

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

Postby owlbrudder » 02 Jan 2011 06:26

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.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 35 guests