Sound is not synchronised with the video

Bug #805807 reported by test007
146
This bug affects 31 people
Affects Status Importance Assigned to Milestone
VLC media player
Fix Released
High
Rémi Denis-Courmont
Nominated for 1.1 by Rémi Denis-Courmont
Nominated for 2.0 by Rémi Denis-Courmont
pulseaudio (Ubuntu)
Invalid
Undecided
Unassigned
Natty
Invalid
Undecided
Unassigned
Oneiric
Invalid
Undecided
Unassigned
vlc (Ubuntu)
Fix Released
High
Unassigned
Natty
Won't Fix
Undecided
Unassigned
Oneiric
Fix Released
Undecided
Unassigned

Bug Description

Hi,

I'm running Ubuntu Natty 11.04 on my laptop Dell Studio 1537. Since the latest update of VLC (1.1.9-1ubuntu1.2) the sound is not synchronised with the video (about 1 second of offset).

Thanks in advance,
---
Architecture: i386
DistroRelease: Ubuntu 11.04
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
NonfreeKernelModules: fglrx
Package: vlc 1.1.9-1ubuntu1.2
PackageArchitecture: i386
ProcEnviron:
 LANGUAGE=fr:en
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Tags: natty
Uname: Linux 2.6.38-8-generic i686
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm admin cdrom dialout libvirtd lpadmin plugdev sambashare www-data

Related branches

Revision history for this message
test007 (test007-deactivatedaccount) wrote : Dependencies.txt

apport information

tags: added: apport-collected natty
description: updated
Revision history for this message
test007 (test007-deactivatedaccount) wrote : RelatedPackageVersions.txt

apport information

Revision history for this message
Andrew McCarthy (andrewmccarthy) wrote :

I can confirm this also on amd64, and that downgrading to 1.1.9-1ubuntu1.1 fixes it. This is mentioned in bug #743323 around comment 32 onwards.

Changed in vlc (Ubuntu):
status: New → Confirmed
Revision history for this message
Benjamin Drung (bdrung) wrote :

1.1.9-1ubuntu1.2 uses the same code for the pulseaudio output, which make this bug also affect 11.10 (oneiric). Will the sound synchronized if you select ALSA as output device?

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

With the "pulse" device, the VLC ALSA output fails most of the time for me. It just stays always late, typically by a large fraction of one audio "packet" (8192 samples). The result is undecipherable continuous stutter. I get this with both AC97 and HDA devices.
The VLC ALSA output was designed many years ago with hardware in mind. It queues the next audio packet while the previous one is (supposed to) be played. This does not give much margin for one extra software buffer, like PulseAudio.

As for the PulseAudio output, it worked mostly like the ALSA one up to VLC version 1.1.9 (and was also leaking memory like hell in some cases as we know). Lip synchronization was a side effect of the small duration of the audio buffer.

In version 1.1.10, there really is no synchronization. Audio is fed as it comes, PulseAudio is told what the expected buffer fill level is. That is currently half a second. So long as the audio decoding and filtering is fast, and the system and audio clocks do not drift, this provides poor but still passable synchronization. If decoding is slow, or if for some reason the system clock and the audio timing drift, desynchronization can unfortunately reach several hundreds of milliseconds.

At this point in time, there are no audio output plugins that fill all of the requirements for quality playback through PulseAudio:
(1) long enough buffers to avoid stutter,
(2) no outrageous bugs like bug #743323,
(3) functional synchronization.

The ALSA plugin fails (1), as do SDL and PortAudio (if it comes to that). The old PulseAudio plugin kind fails (1) and totally fails (2). The new PulseAudio plugin fails (3). Pick your evil... or suspend PulseAudio while using VLC. <rant>Bluntly, I am rather disappointed at the complete lack of consideration and help from distributions like Ubuntu for the VLC team (and possibly anything other than gstreamer) w.r.t. to PulseAudio integration in how many years since they decided to introduce it by default.</rant> We will be very lucky if we get it to FINALLY work in VLC 1.2.0 WITHOUT Ubuntu's help.

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

The following patch and the its two immediate predecessors reduces the de-synchronization for me:
http://git.videolan.org/?p=vlc/vlc-1.1.git;a=commit;h=541a18d06d7477d1d97a867fd25a3979d8235834 reduce

I do not claim that they fully solve the problem. Seeking is still a bit problematic for instance. But you can pause to force re-synchronization.

tags: added: patch-accepted-upstream
Changed in vlc:
importance: Undecided → High
status: New → In Progress
assignee: nobody → Rémi Denis-Courmont (rdenis)
milestone: none → 1.1.12
Revision history for this message
Rémi Denis-Courmont (rdenis) wrote :

...reduce the severity of the issue. Oops

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

And another patch to protect against long-term drift:
http://git.videolan.org/?p=vlc.git;a=commitdiff;h=ccb049c1f3e71a5303181e690ac5b06339021bd9

If I don't get any feedback before VLC 1.1.12 deadline, I'm going to assume they're good. Don't come and complain after the fact.

Changed in vlc:
milestone: 1.1.12 → none
status: In Progress → Fix Committed
Changed in pulseaudio (Ubuntu):
status: New → Invalid
Changed in vlc:
milestone: none → 1.1.12
Revision history for this message
Benjamin Drung (bdrung) wrote :

I uploaded a current snapshot of the vlc-1.1 branch to my PPA [1]. Please test this version and report back if it fixes your issues.

[1] https://launchpad.net/~bdrung/+archive/ppa

Revision history for this message
test007 (test007-deactivatedaccount) wrote :

https://launchpad.net/~bdrung/+archive/ppa

Hi,

It seems to work now! :)

Thanks!

Benjamin Drung (bdrung)
Changed in pulseaudio (Ubuntu Natty):
status: New → Invalid
Revision history for this message
Benjamin Drung (bdrung) wrote :

vlc 1.1.9-1ubuntu1.3 works fine on my system (crystal clear synchronised sound), but the package from my PPA leads to crackling sound. So these patches contain a regression for me.

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 805807] Re: Sound is not synchronised with the video

Just to rule out driver issues, can we reproduce the fix (or the regression)
using the vlc snapshot with the latest driver from
https://wiki.ubuntu.com/Audio/InstallingLinuxAlsaDriverModules?

Revision history for this message
Benjamin Drung (bdrung) wrote :

The crackling sound is gone when I use the latest alsa driver modules.

I found two problems of vlc from my PPA:

1. When another application is playing music through pulseaudio, I can hear a crackling sound when I open some video files with vlc.

2. When another application is playing music through pulseaudio, the sound is not perfectly synchronised with the video (the lips are not in sync with the sound).

Revision history for this message
Benjamin Drung (bdrung) wrote :

3. When seeking, sometimes a crackle can be heard.

Changed in vlc (Ubuntu Natty):
status: New → Confirmed
Revision history for this message
Rémi Denis-Courmont (rdenis) wrote :

1. I've heard the cracks in case of concurrent PulseAudio usage, though I cannot reliably reproduce the problem. But PulseAudio did not notify VLC of any buffer under-run. So I have to believe that this is a bug in mixing by the PulseAudio daemon.

2. VLC should print warnings if it notices audio drifts. I have not experienced this problem.

3. That's a known issue. VLC will insert a period of silence to synchronize when resuming from pause. Therei s currently no way to tell PulseAudio to trigger the stream in a certain delay, only "now". Unfortunately, the silence will come after rather than before the samples that is stuck in the buffer during pause. It might to play with the pre-buffering level instead but I do not know any volunteer to implement this.

Changed in vlc:
status: Fix Committed → Fix Released
Revision history for this message
Rene (g.xrc) wrote :

Hi,
on my recent PC with natty 64
$ uname -a
Linux rg 2.6.38-11-generic #48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
$ lshw -c Multimedia
  *-multimedia
       description: Audio device
       product: SBx00 Azalia (Intel HDA)
       vendor: ATI Technologies Inc
       physical id: 14.2
       bus info: pci@0000:00:14.2
       version: 40
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list
       configuration: driver=snd_hda_intel latency=64
       resources: irq:16 memory:fccf4000-fccf7fff
$ lspci -vv
00:14.2 Audio device: ATI Technologies Inc SBx00 Azalia (Intel HDA) (rev 40)
 Subsystem: ATI Technologies Inc SBx00 Azalia (Intel HDA)
 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
 Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
 Latency: 64, Cache Line Size: 64 bytes
 Interrupt: pin A routed to IRQ 16
 Region 0: Memory at fccf4000 (64-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: snd_hda_intel
 Kernel modules: snd-hda-intel

With system up to date
VLC 1.1.9-1ubuntu1.3 (natty-update) => I get the audio sync issue as described above.
xine is well sync, but just some cracking pb sometime.
Totem 2.32.0 is ok.

I tried the VLC package https://launchpad.net/~bdrung/+archive/ppa
which is not usable at all.

I went back to VLC 1.1.9-1ubuntu1.3 (natty-update)
the issue is back

I installed ALSA drivers from https://wiki.ubuntu.com/Audio/InstallingLinuxAlsaDriverModules
version is 2.6.38-11.201108241605
and... everything is just working correctly, still with VLC 1.1.9-1ubuntu1.3. sync is ok.
If I uninstall alsa driver, the issue is back, re-install corrects it.

my conclusion:
>> There is something wrong with VLC, because with same config, totem and xine are ok
>> There is something wrong in snd-hda-intel ALSA driver too, but it is corrected in last driver.
hardware description:
motherboard ASUS M4A87TD EVO
Audio chipset VIA VT1818

I have a second PC : Laptop Compaq evo n610c, running natty 32bits
it has integrated 82801CA AC97 audio
kernel module snd-intel8x0
VLC working just fine, sync ok!

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

This bug was fixed in the package vlc - 1.1.12-2

---------------
vlc (1.1.12-2) unstable; urgency=low

  * Apply patches from upstream's 1.1 maintenance branch.
    - Turn on XVideo color key automatic painting (fix upstream #4643)
    - Set channel map when using PulseAudio 1.0
    - Translation updates

 -- Benjamin Drung <email address hidden> Thu, 13 Oct 2011 20:17:03 +0200

Changed in vlc (Ubuntu):
status: Fix Committed → Fix Released
Changed in pulseaudio (Ubuntu Oneiric):
status: New → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in vlc (Ubuntu Oneiric):
status: New → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Jacky672, or anyone else affected,

Accepted vlc into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in vlc (Ubuntu Oneiric):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
test007 (test007-deactivatedaccount) wrote :

Hi,

I just install Oneiric so:

- We have this VLC bug with the fresh install
- A updrade to oneiric-proposed/universe vlc i386 1.1.12-1 solve this bug, VLC work well now

Thanks!

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

due to the latest comment I'm going set the "verification-done" tag.

BTW The bug is fixed for me too.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Benjamin Drung (bdrung) wrote :

I uploaded vlc 1.1.12-2~oneiric1 to oneiric-proposed, because 1.1.12-1 does not set the channel map when using PulseAudio. Therefore I set the tag back to verification-needed.

tags: added: verification-needed
removed: verification-done
Revision history for this message
VPablo (villumar) wrote :

On Natty, with vlc 1.1.12 from a PPA (n-muench) the bug is also fixed.

Revision history for this message
Martin Pitt (pitti) wrote :

1.1.12-2~oneiric1 accepted into oneiric-proposed, please test that instead. Thanks!

Revision history for this message
test007 (test007-deactivatedaccount) wrote :

Hi,

I confirm that this version also works on my oneiric, thanks.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vlc - 1.1.12-2~oneiric1

---------------
vlc (1.1.12-2~oneiric1) oneiric-proposed; urgency=low

  * No-change backport to oneiric to fix PulseAudio support and other bugs.

vlc (1.1.12-2) unstable; urgency=low

  * Apply patches from upstream's 1.1 maintenance branch.
    - Turn on XVideo color key automatic painting (fix upstream #4643)
    - Set channel map when using PulseAudio 1.0
    - Translation updates

vlc (1.1.12-1) unstable; urgency=low

  * New upstream release.
    - Multiple fixes and improved synchronization for PulseAudio support
      (Closes: #601826, LP: #805807).
    - Fix segmentation fault (LP: #803006).
    - Addd GenericName entries to desktop file (Closes: #640911).
    - Do not ignore the --quiet flag (Closes: #531975).
    - Fix vlc runs xdg-screensaver with signal child blocked (Closes: #640245).
    - Fix crashes when trying to play youtube URLs (Closes: #641507).
  * Drop xulrunner-1.9.1.patch (accepted upstream).
  * Refresh 200_osdmenu_paths.patch.
  * Fix typo in vlc.desktop: Name[nn] -> GenericName[nn].
 -- Benjamin Drung <email address hidden> Wed, 19 Oct 2011 21:18:35 +0200

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

natty is EOL.

Changed in vlc (Ubuntu Natty):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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