TheCactusVert / mpv-sponsorblock

MPV plugin that allow you to skip sponsors while watching YouTube videos
MIT License
49 stars 3 forks source link

Endless skip-loop in audio-only mode after skipping an ad #18

Open naglis opened 6 months ago

naglis commented 6 months ago

Using v2.1.0 on Arch Linux (x86-64) with mpv v0.38.0.

When playing only the audio of a Youtube video that has ads, mpv-sponsorblock sometimes enters a skip-loop after skipping the ad. The loop can be exited by manually seeking forward a second. Playing only the audio part is sometimes useful to save network bandwidth/skip video decoding if the video part is not relevant.

This does not happen 100% of the time. Currently, I've only been able to reproduce it when using a Bluetooth headset (I am using PipeWire audio output) which I suspect might have some impact on the time-pos property reported by mpv. Also, I've found that for some videos it depends on the audio format and/or quality (e.g. using --ytdl-format=worstaudio would not cause the loop).

To reproduce (note that --start=348 will skip to the position 2 seconds before the ad):

RUST_LOG=trace mpv --ytdl-format=bestaudio --no-resume-playback --start=348 'https://www.youtube.com/watch?v=T1KXeTd30KI'
Trace logs of the loop ``` [2024-04-30T09:36:05Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 statusline: A: 00:07:17 / 00:11:52 (61%) Cache: 274s/11MB [-------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------][2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:05Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:05Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:06Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:06Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z INFO mpv_sponsorblock::client] Skipped segment [sponsor] 350.621 - 437.6 [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] [2024-04-30T09:36:07Z TRACE mpv_sponsorblock::client] Received property-change event [time-pos] ... ```

After some debugging, I've found that the time-pos reported by mpv after skipping an ad would fall slightly before the end of the segment that was skipped (even after the 0.1s adjustment) and the segment therefore would be matched and skipped, causing an endless loop.

Please let me know if more information is needed.

TheCactusVert commented 6 months ago

I had this problem once, so I implemented this quick and dirty fix of 0.1s but the problem seems harder than I initially thought. I won't increase the value, I didn't like the solution when I first implemented it. I will look into it thanks.