mpv icon indicating copy to clipboard operation
mpv copied to clipboard

mpv loses audio/sub sync (and laggy video) when pause/resume the video

Open passthesh3ll opened this issue 3 years ago • 7 comments

Important Information

Provide following Information:

  • mpv version: mpv (1:0.34.1-5)
  • Linux Distribution and Version: Arch Linux (all software up to date)
  • Source of the mpv binary: Arch Linux Community Repository
  • If known which version of mpv introduced the problem: I don't know but I have this problem for 2-3 months
  • Window Manager and version: Xfwm4 (XFCE)
  • GPU driver and version: NVIDIA 520.56.06 (dkms package)
  • Possible screenshot or video of visual glitches: it's an audio/subtitle problem

The problem is seems not OS related because if I use another OS or if I open the same video but using VLC player, the problem doesn't show up

Reproduction steps

Reproducing the issue isn't deterministic, it seems a buffer related problem. Anyway:

  1. open a video and watch for 10-20min
  2. pause and play the video again.

Expected behavior

The video should play as was before

Actual behavior

After playing again the video, its audio/subtitles will be be out of sync and the video will be laggy. After about 10-15s the video returns normal.

Log file

I played the file until 2m:30s than I pause the video and after playing again it got desynced. Then after around 10s it returns synced. Log: https://bin.disroot.org/?047d12929996d5a1#2Febx6DaqaDp5HGaGEuRUT2qYWLBRpF5h8e371j4etSS

Sample files

I don't know, every file has this problem. It seems that very small files (maybe video of a few megabytes) have this problem more rarely or don't have the problem at all.

passthesh3ll avatar Oct 27 '22 08:10 passthesh3ll

I'm having a very similar problem, and had it for a long time. Except the a/v lag is easier to trigger, and seems to fix itself after a few seconds.
Also Arch Linux.
All videos (network and local) are affected.

Try

ao=alsa

It seems to have fixed it. And even though I'm using pulseaudio, everything is still working, bluetooth speakers etc.

ohnonot avatar Nov 05 '22 13:11 ohnonot

Stock Ubuntu 22.04 did this (or at least something very similar) to me before I took steps to switch it to using pipewire. Since pipewire is now the default on 22.10, I've not had to do the same. So I mean, it's not out of the question that something within the last year broke pulse's handling of this sort of thing.

qyot27 avatar Nov 06 '22 03:11 qyot27

I'm getting it too in Ubuntu 22.04, what steps did you take? What I found so far is a guide here:

https://askubuntu.com/questions/1333404/how-to-replace-pulseaudio-with-pipewire-on-ubuntu-21-04

Hopefully I won't do something wrong and create an even bigger issue, my Linux experience isn't more than a couple of weeks.

Edit:

It works now after trying a bunch of things without really knowing what I'm doing.

stax76 avatar Nov 08 '22 16:11 stax76

I'd followed https://ubuntuhandbook.org/index.php/2022/04/pipewire-replace-pulseaudio-ubuntu-2204/

qyot27 avatar Nov 08 '22 20:11 qyot27

I had tried the accepted answer at the askubuntu thread, which did not work, the answer below suggested the project which worked:

https://github.com/pipewire-debian/pipewire-debian/

stax76 avatar Nov 09 '22 03:11 stax76

I'm having a very similar problem, and had it for a long time. Except the a/v lag is easier to trigger, and seems to fix itself after a few seconds. Also Arch Linux. All videos (network and local) are affected.

Try

ao=alsa

It seems to have fixed it. And even though I'm using pulseaudio, everything is still working, bluetooth speakers etc.

this mpv config seems to fix the problem

passthesh3ll avatar Nov 10 '22 09:11 passthesh3ll

I'm having a very similar problem, and had it for a long time. Except the a/v lag is easier to trigger, and seems to fix itself after a few seconds. Also Arch Linux. All videos (network and local) are affected.

Try

ao=alsa

It seems to have fixed it. And even though I'm using pulseaudio, everything is still working, bluetooth speakers etc.

update: this config doesn't solve the problem, it fixes audio desync but lag after play/pause of the video is still present. Do you think the problem is related to pulseaudio?

passthesh3ll avatar Nov 11 '22 22:11 passthesh3ll

ao=alsa is already removed from MPV until release 0.23.0

problem exist in Arch linux but I check it on win 10 there is no any problem like that on it.

arsalanrez avatar Mar 22 '23 20:03 arsalanrez

I can confirm too that the latest version of mpv in archlinux (updated to today) still has this problem and there isn't any temporary fix that I know

passthesh3ll avatar Mar 22 '23 20:03 passthesh3ll

I can confirm too that the latest version of mpv in archlinux (updated to today) still has this problem and there isn't any temporary fix that I know

actually I fixed this with someone's config file on Github I'll share it with your and I hope This work for your system too.

This is the github DotFiles : https://github.com/Pakrohk-DotFiles/MPV.git

so you can clone all config with This : git clone --depth 1 https://github.com/Pakrohk-DotFiles/MPV.git ~/.config/mpv

arsalanrez avatar Mar 23 '23 19:03 arsalanrez

If anyone has this problem, it's because of pulseaudio. You can workaround it with --pulse-latency-hacks or use another ao.

Dudemanguy avatar May 01 '23 00:05 Dudemanguy