mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.06k stars 2.88k forks source link

ao_avfoundation frame drops and audio delay on playback speed changes #14483

Open stps opened 3 months ago

stps commented 3 months ago

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

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:

ruihe774 commented 3 months ago

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.