mpv-player / mpv-player/mpv

Inconsistent Audio Delay When Starting Video Playback

Open
#11,446 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

I'm running mpv on a home-theatre PC connected to a TV through a receiver. I'm using a Sync-One2 to measure audio-delay so I can add an audio-delay=… to my mpv.conf. I am experiencing a bug where the reported delay is different for each launch of mpv or when resuming playback from pause. There's no drift during playback; the timing remains steady (within a couple of ms) when playing video. The delay is just different each time I start playback.

System information

OS: Linux Mint 21.1 x86_64 
Kernel: 5.19.0-35-generic 
CPU: Intel i3-10100F (8) @ 4.300GHz 
GPU: NVIDIA GeForce GT 1030
Window Manager: Cinnamon 5.6.7
NVidia Driver: 525.85.05
ALSA v: k5.19.0-35-generic

I'm using a mpv that I built on this system using mpv-build and the steps for Debian packages

mpv 0.35.0-317-g9880b06a37 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Mon Mar 13 09:30:36 2023
libplacebo version: v5.264.0-rc1-4-g61a9f2bf
FFmpeg version: N-110002-g7c130d6911
FFmpeg library versions:
   libavutil       58.3.100
   libavcodec      60.6.101
   libavformat     60.4.100
   libswscale      7.2.100
   libavfilter     9.4.100
   libswresample   4.11.100

If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases

Reproduction steps

  1. Measure audio delay using the measurement process for the Sync-One2 specified in its manual.
  2. Pause video playback and then resume or re-launch mpv
  3. Observe a different delay amount

This issue is still reproducible with only the output device configured.

pasuspender -- \
mpv \
--no-config \
--load-scripts=no \
--audio-device=alsa/hdmi:CARD=NVidia,DEV=0 \
--audio-channels=7.1,5.1,stereo \
--fullscreen \
--log-file=/tmp/sync-log.log \
Sync-One2_Test_1080p_23.98_HEVC_PCM_5.1.mov
Expected behavior

Every launch of mpv or resume of video playback has the same audio delay.

Actual behavior

The audio delay varies between runs of mpv or after resuming playback. The variations are multiple 10s of ms so quite noticeable.

Log file

Log file

Sample files

Using the standard Sync-One2 test files

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided pasuspender/mpv command, the configured HDMI device, and the Sync-One2 test file. Compare the resulting /tmp/sync-log.log output across launches and pause/resume cycles; done means audio delay is consistent across runs while playback remains drift-free.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
audio-video-rtc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.