mpv-player / mpv

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

audio goes silent after skipping/fast forward/fast backward #14969

Open mitzsch opened 1 month ago

mitzsch commented 1 month ago

mpv Information

[   0.001][v][cplayer] mpv v0.39.0-24-g53f2619d Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
[   0.002][v][cplayer]  built on Sep 27 2024 00:12:05
[   0.002][v][cplayer] libplacebo version: v7.349.0 (v7.349.0-13-ga018ab0-dirty)
[   0.002][v][cplayer] FFmpeg version: N-117212-g01c47dd23
[   0.002][v][cplayer] FFmpeg library versions:
[   0.002][v][cplayer]    libavcodec      61.20.100
[   0.002][v][cplayer]    libavdevice     61.4.100
[   0.002][v][cplayer]    libavfilter     10.5.100
[   0.002][v][cplayer]    libavformat     61.8.100
[   0.002][v][cplayer]    libavutil       59.40.100
[   0.002][v][cplayer]    libswresample   5.4.100
[   0.002][v][cplayer]    libswscale      8.4.100

Other Information

- Windows version: Windows 11 - Microsoft Windows NT 10.0.22631.0/22631.4169
- GPU model, driver and version: RTX3060 TI - Game Ready - 565.90
- Source of mpv: shinchiro
- Introduced in version: not known

Reproduction Steps

Open a movie file fast forward/fast backward many times, and/or click randomly in the OSD at different spots in the timeline. After doing this multiple times the audio goes silent.

In the log, these lines get printed:

[  30.381][v][cplayer] delaying audio start 2231.376979 vs. 2230.061000, diff=1.315979
[  30.424][v][cplayer] delaying audio start 2231.376979 vs. 2230.103000, diff=1.273979
[  30.466][v][cplayer] delaying audio start 2231.376979 vs. 2230.145000, diff=1.231979
[  30.507][v][cplayer] delaying audio start 2231.376979 vs. 2230.186000, diff=1.190979
[  30.548][v][cplayer] delaying audio start 2231.376979 vs. 2230.228000, diff=1.148979
[  30.590][v][cplayer] delaying audio start 2231.376979 vs. 2230.270000, diff=1.106979
[  30.633][v][cplayer] delaying audio start 2231.376979 vs. 2230.311000, diff=1.065979
[  30.673][v][cplayer] delaying audio start 2231.376979 vs. 2230.353000, diff=1.023979
[  30.715][v][cplayer] delaying audio start 2231.376979 vs. 2230.395000, diff=0.981979
[  30.757][v][cplayer] delaying audio start 2231.376979 vs. 2230.437000, diff=0.939979
[  30.799][v][cplayer] delaying audio start 2231.376979 vs. 2230.478000, diff=0.898979
[  30.840][v][cplayer] delaying audio start 2231.376979 vs. 2230.520000, diff=0.856979
[  30.883][v][cplayer] delaying audio start 2231.376979 vs. 2230.562000, diff=0.814979
[  30.925][v][cplayer] delaying audio start 2231.376979 vs. 2230.603000, diff=0.773979
[  30.965][v][cplayer] delaying audio start 2231.376979 vs. 2230.645000, diff=0.731979
[  31.008][v][cplayer] delaying audio start 2231.376979 vs. 2230.687000, diff=0.689979
[  31.049][v][cplayer] delaying audio start 2231.376979 vs. 2230.729000, diff=0.647979
[  31.091][v][cplayer] delaying audio start 2231.376979 vs. 2230.770000, diff=0.606979
[  31.133][v][cplayer] delaying audio start 2231.376979 vs. 2230.812000, diff=0.564979
[  31.174][v][cplayer] delaying audio start 2231.376979 vs. 2230.854000, diff=0.522979
[  31.216][v][cplayer] delaying audio start 2231.376979 vs. 2230.895000, diff=0.481979
[  31.257][v][cplayer] delaying audio start 2231.376979 vs. 2230.937000, diff=0.439979
[  31.300][v][cplayer] delaying audio start 2231.376979 vs. 2230.979000, diff=0.397979
[  31.341][v][cplayer] delaying audio start 2231.376979 vs. 2231.020000, diff=0.356979
[  31.383][v][cplayer] delaying audio start 2231.376979 vs. 2231.062000, diff=0.314979
[  31.425][v][cplayer] delaying audio start 2231.376979 vs. 2231.104000, diff=0.272979
[  31.467][v][cplayer] delaying audio start 2231.376979 vs. 2231.146000, diff=0.230979
[  31.508][v][cplayer] delaying audio start 2231.376979 vs. 2231.187000, diff=0.189979
[  31.549][v][cplayer] delaying audio start 2231.376979 vs. 2231.229000, diff=0.147979
[  31.591][v][cplayer] delaying audio start 2231.376979 vs. 2231.271000, diff=0.105979
[  31.633][v][cplayer] delaying audio start 2231.376979 vs. 2231.312000, diff=0.064979
[  31.680][v][cplayer] delaying audio start 2231.376979 vs. 2231.354000, diff=0.022979
[  31.716][v][cplayer] starting audio playback
[  31.716][v][cplayer] audio draining
[  31.716][d][ao/wasapi] Thread Resume
[  31.716][d][ao/wasapi] Thread Reset
[  31.716][d][ao/wasapi] Thread Pause
[  31.716][v][cplayer] audio EOF reached

Sometimes the audio comes back after the diff= goes to zero but in my testing, most of the time, the audio stays silent after the diff counter goes to zero. The log also indicates "audio EOF reached" which is not true.

I tested an older version of mpv that I had lying around on my PC. That does not exhibit this behavior. (mpv v0.37.0-766-ge42a8d53)

Expected Behavior

Fast forward/fast backward as many often as you want, without losing audio.

Actual Behavior

Fast forward/fast backward very often, audio playback is lost.

Log File

mpv-scrub-audio-out_new.txt

Snipped of a log on a different file with a DTS-HD track

audio-delay-after-skip.txt

Log of old mpv that does not show this issue:

mpv-scrub-audio-out_olderV.txt

Sample Files

No response

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

llyyr commented 1 month ago

Can you upload the audio track?

mitzsch commented 1 month ago

unfortunately, I'm not allowed to upload that track... copyright. I will do some more testing, maybe I can find the version that introduced that behavior.

fir05 commented 1 month ago

I have a similar problem, after adjusting the progress, the video stutters, the audio is fine, and sometimes the video is fine but there is no sound. Error reported: 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-safe as they may help.

There is no problem with the hardware The cpu is not occupied Files are played using PotPlayer without this problem The parameter “profile=fast,hwdec=auto-safe” was use

I use mpv.dll from this page https://github.com/shinchiro/mpv-winbuild-cmake/releases When I switch to the old 20240720 version of mpv.dll there is also no problem

I only found this problem on a highly compressed 4K mkv video.

mitzsch commented 3 weeks ago

I did some further investigation - with the limited old builds I have I could track it down to a change between build "a3baf94" (18.08.2024) and "e3a9ce2" (22.08.2024)

However, there does not seem to be a change that could affect it on mpvs side.

While debugging this message

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-safe as they may help.

also got printed from time to time.

I only found this problem on a highly compressed 4K mkv video.

On my end, it also only shows up on 4K HEVC files.

Now I assume its something with FFmpeg - between the commits "https://github.com/ffmpeg/FFmpeg/commit/5c1c0325cd1bd3f826bbd73dffd0b07974a586bd" and "https://github.com/ffmpeg/FFmpeg/commit/9d15fe77e33b757c75a4186fa049857462737713"

There are multiple HEVC-related commits... Debugging them is way ahead of my skills.

llyyr commented 3 weeks ago

If you can't share a sample and also can't bisect then I'm at a loss for how to proceed here. I guess you can create a sample if it happens with every 4k hevc sample?

mitzsch commented 3 weeks ago

I will try to reproduce it with big Buck Bunny... The problem with a sample is that its not really on a specific spot and is more like happening randomly when skipping/rewinding...

fir05 commented 2 weeks ago

It seems to be this video file that triggers the issue: magnet:?xt=urn:btih:cd4c80cb6dfc825a8dc46a4fee6f14676127d8b4

I've been using the July version, but a couple of times I've tested the latest version and I've run into this problem. Looks like I'll be stuck with this July version for a long time.