Code Monkey home page Code Monkey logo

mpv-sponsorblock's Issues

Create a binary release workflow

It would be nice to have a binary release for the shared library so that a user may only have to download and place it in the right location besides the config.

I can write a github actions workflow to automate this if you are interested.

Doesn't work with python-mpv

It detects the segments and shows them in the timeline, but doesn't actually skip anything, even though I set it to do so in the config. I placed all the files in the right places and everything works fine with the command line version. I also looked through the log output (debug level) but didn't seem to find anything useful.

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

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.

Sponsorblock works and skips the sections but only audio plays! Video doesn't play!

Note: Without this extension mpv plays youtube video without any trouble!


  • Configuration
$ cat sponsorblock.toml

# Server address
server_address = "https://sponsor.ajay.app"
# Categories: sponsor, selfpromo, interaction, poi_highlight, intro, outro, preview, music_offtopic, filler, exclusive_access
categories = ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "music_offtopic", "exclusive_access"]
# Action types: skip, mute, poi, full
action_types = ["skip"]
# Get segments for a video with extra privacy 
privacy_api = false
# Third party YouTube domains like Piped, Invidious or CloudTube
domains = ["piped.kavin.rocks", "invidious.kavin.rocks"]
# Use OSD when a segment is skipped or muted
skip_notice = false
  • Example (with extension)
$ mpv https://www.youtube.com/watch?v=6YF0XNMpyoM
 (+) Video --vid=1 (*) (vp9 1920x1080 23.976fps)
 (+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
File tags:
 Uploader: Jonathan Antoine
 Channel_URL: https://www.youtube.com/channel/UC1aQpzmR_Nf0C7ElGiySLQg
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
AO: [pipewire] 48000Hz stereo 2ch floatp
AV: 00:00:31 / 00:05:37 (9%) A-V:  0.000 Cache: 305s/12MB

  • Example (without extension)
$ mpv https://www.youtube.com/watch?v=6YF0XNMpyoM
 (+) Video --vid=1 (*) (vp9 1920x1080 23.976fps)
 (+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
File tags:
 Uploader: Jonathan Antoine
 Channel_URL: https://www.youtube.com/channel/UC1aQpzmR_Nf0C7ElGiySLQg
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:03 / 00:05:37 (1%) A-V:  0.000 Cache: 63s/28MB

Better documentation

Could the config be documented better? Eg. what is the "poi" or "full" action in action_types?

Issue when fetching segments

While testing my setup on this video, the following error is printed to the terminal:

[2023-07-12T21:47:12Z ERROR mpv_sponsorblock::client::worker] Failed to get segments: error decoding response body: missing field `hash` at line 1 column 675

I also tested this on other videos, and they gave the same error.

Add license

It will be great if you can add an open source license, so that the community can make full use of it and legally link it to mpv.

Invalid UTF-8 sequences in filenames cause mpv to segfault

Using 2.0.0 on Arch Linux (x86-64) with mpv v0.37.0.
To reproduce (assuming mpv-sponsorblock is installed; use bash for the ANSI-C quoting):

mkdir test
cd test
touch $'foo\xf0.mp3'
RUST_LOG=trace mpv --load-scripts=yes --no-resume-playback *.mp3 'https://www.youtube.com/watch?v=aqz-KE-bpKQ'

I get:

[2024-03-01T10:18:18Z DEBUG mpv_sponsorblock] Starting plugin SponsorBlock [sponsorblock]!
[2024-03-01T10:18:18Z TRACE mpv_sponsorblock::client] Received start-file event
   cplayer: Playing: foo.mp3
Segmentation fault (core dumped)

Disabling scripts (I only have mpv-sponsorblock installed):

RUST_LOG=trace mpv --load-scripts=no --no-resume-playback *.mp3 'https://www.youtube.com/watch?v=aqz-KE-bpKQ'

I get:

   cplayer: Playing: foo.mp3
   cplayer: Failed to recognize file format.
   cplayer: Playing: https://www.youtube.com/watch?v=aqz-KE-bpKQ

I am reporting it here (and not in mpv's bugtracker) since it only occurs when mpv-sponsorblock is installed and enabled. If it is mpv's bug in handling script crashes, please let me know and I'll report it there.
Hopefully this is reproducible, please let me know if you need more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.