mpv-player / mpv-player/mpv

AVFoundation causes frame drops when resuming from an underrun state.

Open
#16,346 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

mpv Information
mpv v0.40.0-dev-gf9ec3d2c2 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on May 14 2025 13:53:42
libplacebo version: v7.349.0
FFmpeg version: 7.1.1
FFmpeg library versions:
   libavcodec      61.19.101
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100
Other Information
- macOS version: macOS 15.1.1 
- Source of mpv: https://nightly.link/mpv-player/mpv/workflows/build/master
- Latest known working version: -
- Issue started after the following happened: -
Reproduction Steps
mpv --no-config  --input-commands='script-message display-stats-toggle'  --hwdec=yes  --ao=avfoundation [slow_url]
Expected Behavior

Don't drop frames when resuming from an underrun state.

Actual Behavior

When the playback URL is slow, the player pauses to buffer after underrun. However, resuming playback causes a drop of approximately 30 or more frames.

Log File
● Video  --vid=1  (h264 720x540 25 fps) [default]
● Audio  --aid=1  (aac 1ch 48000 Hz 16 kbps) [default]
Using hardware decoding (videotoolbox).
AO: [avfoundation] 48000Hz mono 1ch float
VO: [gpu] 720x540 videotoolbox[nv12]
AV: 00:00:00 / 00:23:43 (0%) A-V:  0.000 Cache: 0.0s/196KB2025-05-15 11:51:36.081 mpv[94746:20250838] +[IMKClient subclass]: chose IMKClient_Modern
2025-05-15 11:51:36.081 mpv[94746:20250838] +[IMKInputSession subclass]: chose IMKInputSession_Modern
Audio device underrun detected.

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).
Consider trying `--profile=fast` and/or `--hwdec=auto` as they may help.

Audio device underrun detected.
Audio device underrun detected.
Audio device underrun detected.
Audio device underrun detected.
Audio device underrun detected.
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 1, offset 0x3e6c7b: partial file
AV: 00:00:34 / 00:23:43 (2%) A-V:  0.000 Dropped: 184 Cache: 3.1s/759KB
Exiting... (Quit)

mpv_debug.log

Sample Files

No response

I carefully read all instruction and confirm that I did the following:
  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.

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 tracing the AVFoundation audio-output path used by --ao=avfoundation, focusing on underrun recovery and its interaction with video timing. Reproduce with the supplied mpv --no-config command and attached debug log; done means playback resumes without the reported burst of dropped frames.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
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.