Audio sync problem streaming ubuntu 10.10 VLC 1.1.4

Bug #686248 reported by MrGreg
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
VLC media player
Fix Released
Unknown
vlc (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The audio-sync function does not appear to work correctly in VLC 1.1.4 Ubuntu 10.10 Maverick.

[Symptom]

After initial audio/video sync up using audio-desync, the audio/video sync drifts out noticably within a few minutes and significantly in an hour or so.

* The standard Ubuntu Lucid 10.04 VLC 1.0.6 version performs correctly
* The MS windows (XP) version 1.1.4 performs correctly

[Test case]

A. Setup

* Same Hardware and software setup in both Ubuntu test cases
* Video in: PCI analog capture card (bt878video pci capture card, Hauppauge VCB Impact)
* Audio in: Soundcard line-in
* Std desktop install Ubuntu versions using Std default repos
* +VLC, +ffmpeg libavdevice-extra52, +x264
* Broadcast TV analog out used as test input source. Video into capture card, audio into sound card ( I would usually be using analogue camera and mic/line in)

B. Procedure

 1. Open GUI, test video/audio capture, by "Open Capture device" - Play

 2. Select Streaming from menu, select Capture device tab, all input settings left at default

 3. select Stream, Next, Next , Paste output string into textbox, as follows

 --sout-keep --audio-desync=-40 :sout=#transcode{vcodec=h264,vb=600,deinterlace,ab=64,fps=25,width=160,height=120,acodec=mp3,samplerate=44100,audio-sync}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8082/stream.flv},dst=display}

* Audio-desync value adjusted to initial optimum value (predetermined before test)
* Width and height set to low values to minimise cpu load
* Same procedure in all cases including Win XP. Win test using similar hardware, bt878 pci capture card.

[Appendix]

Suspected that pulseaudio may be the cause:

* Removed pulseaudio and installed alsa mixer. Problem persisted.
* Also tried VLC 1.1.5 from Maverick Bleed PPA. Problem persisted
* Also tried VLC 1.1.4 from Lucid Bleed PPA with Lucid. Problem here as well.

Reported problem to Videolan Trac

Response as follows.

Changes (by courmisch):
 * status: new => closed
 * resolution: => incomplete
 * component: I don't know => Access

Comment: And I bet you get the same effect if you just render the inputs locally,no? Then I would tend to blame the V4L2 and ALSA input plugins for not timestamping correctly. Or it might even be a driver bug.

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

I did not see the problem when playing capture device, only when streaming.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: vlc 1.1.4-1ubuntu1.1
ProcVersionSignature: Ubuntu 2.6.35-23.41-generic 2.6.35.7
Uname: Linux 2.6.35-23-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Mon Dec 6 23:18:34 2010
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
ProcEnviron:
 LANG=en_GB.utf8
 SHELL=/bin/bash
SourcePackage: vlc

Revision history for this message
MrGreg (mr-greg) wrote :
Revision history for this message
MrGreg (mr-greg) wrote :

Update/further info
If package x264 is removed leaving only libx264-98, the audio-desync=xx necessary for initial sync reduces to zero or one frame or so. The audio-sync drift also is much less, but still quite apparent. Noticable in an hour or two and significant beyond 3 hrs plus, getting worse over time.
The Lucid test case had both x264 and libx264-95 installed. The Lucid test case was over a 6.5hr period with some minor flucuations in sync (est a frame or two at random test times) but was still well syncronised at the end of the test period.

Revision history for this message
Fenix-TX (jesusvpct) wrote :

Hi! I'm using this ppa: https://launchpad.net/~n-muench/+archive/vlc

And i'm using this command to stream:

vlc dvb-t:// input_stream --dvb-frequency=538000000 --dvb-adapter=0 --dvb-bandwidth=8 --file-caching=2500 --sout="#transcode{venc=x264{keyint=60,idrint=2,subme=7,ref=3,bframes=16,me=hex,b-adapt=1,merange=16,deblock=-3:3,threads=4,cabac},vcodec=h264,vb=200,scale=0.5,fps=12,acodec=aac,ab=28,channels=1,samplerate=22050,deinterlace}:rtp{dst=127.0.0.1,port=5004,mux=ts,sdp=file:///home/jesus/vlc.sdp}"

Well, before adding mux=ts on rtp section, audio was out of sync, but now using mux=ts the audio goes syncrhonized. Perhaps this helps.

Revision history for this message
MrGreg (mr-greg) wrote :

Hello Fenix-TX
Can you confirm that your solution "Stays" synchronised? Eg after 6Hrs or more
Thanks

Revision history for this message
Fenix-TX (jesusvpct) wrote :

Well, i did not tried so long time, but i will try it today or tomorrow. I will put my results here once i have made my tests.

Revision history for this message
Fenix-TX (jesusvpct) wrote :

After a hour, there is a small out of sync, less than a second, and it increases little by little on time.

Revision history for this message
MrGreg (mr-greg) wrote :

Thank you for taking the time and trouble to check. You have also confirmed the bug on different hardware which is helpfull. Perhaps add yourself to the affected list if appropriate?

Revision history for this message
Fenix-TX (jesusvpct) wrote :

Hi! Have you tried the new version 1.1.6? I don't have time now to try it myself.

Revision history for this message
Nicola Ferralis (feranick) wrote :

FYI, I am pushing builds of VLC 1.1.6 into maverickbleed and lucidbleed ppas:

https://launchpad.net/~lucid-bleed/+archive/ppa
https://launchpad.net/~maverick-bleed/+archive/ppa

They will be available sometimes tomorrow.

Revision history for this message
MrGreg (mr-greg) wrote :

Update#2
Fresh clean install Ubuntu 10.10 & VLC 1.1.7 (maverick-bleed as above) Tried several capture and transcode runs, same bt878 + soundcard + settings as previous update. Results similar, if variable in that the amount of audio desync and the time it became significantly noticable was not consistant. Sometimes within a couple of hours, sometimes could hold well for circa 4 hrs. So problem still present.
Reference check
Installed Ubuntu 10.04 & VLC 1.0.6 on same hardware, 3Ghz P4 dual boot. Again same results as previously seen. Held sync for 12+ hrs with minor fluctuations.

Revision history for this message
Rémi Denis-Courmont (rdenis) wrote :

Propagating upstream status...

Changed in vlc (Ubuntu):
status: New → Incomplete
Changed in vlc:
importance: Unknown → Undecided
status: Unknown → New
status: New → Incomplete
Revision history for this message
Rémi Denis-Courmont (rdenis) wrote :

Is the desynchronization also perceptible when playing back, or only when streaming to somewhere else?

And please don't mix DVB and analog. By design, there cannot be audio/video desync in DVB unless the broadcaster is broken. There may however be desync due to transcoding or outputting from VLC.

Changed in vlc:
status: Incomplete → Invalid
Revision history for this message
MrGreg (mr-greg) wrote :

I only have the problem when streaming to somewhere else, not when playing back.
I am not and have not been using a DVB device. Analogue capture cards only (bt878 type for video input)

Revision history for this message
Festr (festr2) wrote :

Hi, I've the same symptom on oneiric vlc version 1.1.12 streaming microsoft live webcam:

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

The problem is that video is delayed (sound is before video). I've tried audio-sync and without but it has no effect.

Using gstreamer on the same system results in perfect sync even after many hours. I've also tried vlc forum to discuss it there: http://forum.videolan.org/viewtopic.php?f=13&t=95866 and the developer says that the v4l2 drivers are broken in some way.

Changed in vlc:
importance: Undecided → Unknown
status: Invalid → Unknown
Changed in vlc:
importance: Unknown → Undecided
status: Unknown → New
status: New → Incomplete
Bryce Harrington (bryce)
description: updated
Changed in vlc:
importance: Undecided → Unknown
status: Incomplete → Unknown
Revision history for this message
Rémi Denis-Courmont (rdenis) wrote :

Should be fixed in VLC 2.1.0, though there may be other issues with A/V sync.

Changed in vlc (Ubuntu):
status: Incomplete → Fix Committed
Revision history for this message
Benjamin Drung (bdrung) wrote :

Is it possible to backport these changes to the 2.0.x branch or are the required changes too big?

Revision history for this message
Rémi Denis-Courmont (rdenis) wrote :

I don't know; it should not be too difficult. But it does not fit the upstream backport policy (so I won't try).

Changed in vlc:
status: Unknown → Fix Released
Revision history for this message
Benjamin Drung (bdrung) wrote :

This bug might or might not be fixed in VLC 2.0.0 or 2.1.0. Do you experience this bug with Ubuntu 12.04 or later? I mark this bug as fixed. Please set the status back to new if you can still experience with Ubuntu 12.04 or later.

Changed in vlc (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.