mpv icon indicating copy to clipboard operation
mpv copied to clipboard

ao_avfoundation frame drops and audio delay on playback speed changes

Open stps opened this issue 1 year ago • 1 comments

mpv Information

mpv v0.38.0-570-ge78e2c73cf Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Jul  4 2024 19:10:37
libplacebo version: v7.349.0
FFmpeg version: 7.0.1
FFmpeg library versions:
   libavcodec      61.3.100
   libavdevice     61.1.100
   libavfilter     10.1.100
   libavformat     61.1.100
   libavutil       59.8.100
   libswresample   5.1.100
   libswscale      8.1.100

Important Information

  • Platform version: macOS 14.5
  • GPU model, driver and version: M1 Max
  • Source: local build
  • Introduced in version: ?

Reproduction Steps

Play any video with mpv --no-config --ao=avfoundation, change the playback speed with [ and ].

Expected Behavior

Similar performance to CoreAudio, which can handle speed changes smoothly.

Actual Behavior

When increasing or decreasing playback speed, the audio doesn't change speed until a few seconds later (and is out of sync with the video until then).

There are also video stutters: when speed is increased, the video freezes (but mpv doesn't report dropped frames), when decreased there is a smaller stutter with dropped frames reported.

Log File

output.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

  • [X] I tested with the latest mpv version to validate that the issue is not already fixed.
  • [X] I provided all required information including system and mpv version.
  • [X] 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.
  • [X] I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • [X] I attached the full, untruncated log file.
  • [X] I attached the backtrace in the case of a crash.

stps avatar Jul 04 '24 19:07 stps

When increasing or decreasing playback speed, the audio doesn't change speed until a few seconds later (and is out of sync with the video until then). There are also video stutters: when speed is increased, the video freezes (but mpv doesn't report dropped frames), when decreased there is a smaller stutter with dropped frames reported.

This is a known issue. It is mentioned in #11955. I have the plan to alleviate the problem (#14058) - there is no way to change the speed of already enqueued samples, but at least we should ensure AV sync. I'm still working on it; but I have little spare time recently. Maybe I can do it in the future.

ruihe774 avatar Jul 04 '24 20:07 ruihe774