v4l2 alsa streaming audio delay

*nix specific usage questions
festr
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Nov 2011 16:20

v4l2 alsa streaming audio delay

Postby festr » 24 Nov 2011 16:26

Hi,

I'm streaming video and audio from my microsoft live cam

Code: Select all

vlc -I dummy --color 'v4l2:///dev/video0:width=640:height=360' :input-slave=alsa://hw:1,0 --sout='#transcode{acodec=aac,vcodec=h264,audio-sync,width=640,height=360}:rtp{dst=0.0.0.0,sdp=rtsp://0.0.0.0:2323/test.sdp}' -vvvvv --sout-transcode-threads 3 --sout-x264-bframes 0 --no-sout-x264-cabac
vlc - 1.1.12
kernel - 3.1
sound: alsa microsoft life cam

The problem is that video is delayed (sound is before video). I've tried audio-sync and without but it has no effect. I'm stuck at this point so I'm asking here for help

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: v4l2 alsa streaming audio delay

Postby Rémi Denis-Courmont » 24 Nov 2011 16:27

This is a known bug in V4L2. I would like to fix it in VLC, but first the V4L2 developpers need to agree and fix timestamping in the Linux kernel.

In other words, don't hold your breadth.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

festr
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Nov 2011 16:20

Re: v4l2 alsa streaming audio delay

Postby festr » 24 Nov 2011 16:29

Hi, thank you for quick answer! If I use gstreamer, video and audio is in perfect sync. Does it mean that kernel is still broken?

edit: also linphone SIP application streams video/audio in proper sync.

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: v4l2 alsa streaming audio delay

Postby Rémi Denis-Courmont » 24 Nov 2011 16:41

It might be that your specific driver is not buggy (but reportedly most are). Or it might be that the problem is somewhere else.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

festr
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Nov 2011 16:20

Re: v4l2 alsa streaming audio delay

Postby festr » 24 Nov 2011 16:50

is there anything I can do? Should I fill bug tracker or something?

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: v4l2 alsa streaming audio delay

Postby Rémi Denis-Courmont » 24 Nov 2011 17:50

There is no point in filing a bug until the V4L2 developers have agreed on how this should be fixed. Besides, there is already a bug about it, though I don't remember the number.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

festr
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Nov 2011 16:20

Re: v4l2 alsa streaming audio delay

Postby festr » 24 Nov 2011 18:41

Ok but if gstreamer works and also use the same v4l2 stack isnt this problem to vlc anyway? I dont want to argue with you about broken ts but this fact is opposite to saying v4l2 is broken and vlc can do nothing.

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: v4l2 alsa streaming audio delay

Postby Rémi Denis-Courmont » 24 Nov 2011 18:53

If the problem does really come from V4L2 timestamping, and if VLC would follow the spec, it would break worse with most drivers.

Until V4L2 developers fix this mess, I am not going to touch this.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

festr
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Nov 2011 16:20

Re: v4l2 alsa streaming audio delay

Postby festr » 25 Nov 2011 10:29

Ok thank you for clarification. Exists somewhere discussion on v4l list/forum? How about microsoft windows does VLC sync audio/video on RSTP streaming well? What I need to do is to build streming box which will stream usb kamera with audio/video and it seems that it is impossible with ffmpeg and vlc with proper A/V sync. Only gstreamer works but it has its limitations too. Thank you very much for your help.

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: v4l2 alsa streaming audio delay

Postby Rémi Denis-Courmont » 25 Nov 2011 13:20

That would be the linux-media mailing lists. I don't understand the rest of the question.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

festr
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Nov 2011 16:20

Re: v4l2 alsa streaming audio delay

Postby festr » 25 Nov 2011 15:42

Nevermind the rest of the question. Here (https://bugs.launchpad.net/ubuntu/+sour ... bug/686248) is another reports saying that vlc 1.0.6 is synced properly but the 1.1.4 is not. As there is two evidence (gstreamer) and reports saying 1.0.6 version works good it does not support broken ts from linux kernel drivers. Not saying for all drivers but at least microsoft live and aver media grabber card works good with gstreamer in precise sync. (and sorry for my english, not my native lang :)


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 12 guests