Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[YouTube] Combine Metube & SponsorBlock

I have been using MeTube for some time to occasionally download YouTube videos. Now I’ve been looking for a way to combine MeTube with SponsorBlock to get rid of the ads when downloading a file. And it turned out to be possible. You can either use SponsorBlock to add a chapter for an ad segment, or you can use it to remove the ad or any other segment using the remove_sponsor_segments parameter. Currently, it is not possible to do both things (create segment chapters + remove segments). Here the solution to remove ads while downloading:

Create the following JSON File:

{
  "postprocessors": [
    {
      "api": "https://sponsor.ajay.app/",
      "categories": [
        "intro",
        "outro",
        "poi_highlight",
        "selfpromo",
        "sponsor",
        "interaction" 
      ],
      "key": "SponsorBlock",
      "when": "after_filter"
    },
    {
      "force_keyframes": false,
      "key": "ModifyChapters",
      "remove_chapters_patterns": [],
      "remove_ranges": [],
      "remove_sponsor_segments": ["sponsor","interaction","selfpromo"],
      "sponsorblock_chapter_title": "'[SponsorBlock]: ''%(category_names)l'"
    },
    {
      "add_chapters": true,
      "add_infojson": "none",
      "add_metadata": false,
      "key": "FFmpegMetadata"
    }
  ]
}

The relevant parts here are the categories:

  • intro — video intro segments
  • outro — video endings or credits
  • sponsor — sponsored ads/segments to skip
  • selfpromo — creator self-promotion clips
  • interaction — calls to action (like “subscribe” asks)
  • poi_highlight — important highlights or notable moments (Points of Interest)

And the remove_sponsor_segments parameter. Here you can provide all sections you want to have removed during a download.

The last step is to mount the JSON File into the Container:

version: '3'

services:
  metube:
    image: alexta69/metube
    container_name: metube
    restart: unless-stopped
    ports:
      - "8081:8081"
    volumes:
      - ./downloads:/downloads
      - ./ytdl_options.json:/config/ytdl_options.json:ro # the first part must be the path/place of your new created json file
    environment:
      - YTDL_OPTIONS_FILE=/config/ytdl_options.json

To add video links to MeTube you can also use this handy Browser Add-on: MeTube Downloader

Update 28.07.2025: Since MeTube version 2025-07-27, changes to the YTDL_OPTIONS_FILE are monitored and do not require a container restart to take effect.

Update 12.04.2026: To automatically pull the latest MeTube image, I also added watchtower to my docker-compose file. With the option WATCHTOWER_CLEANUP=true, old images are automatically removed.

  watchtower:
    image: containrrr/watchtower
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_POLL_INTERVAL=86400
    command: metube watchtower

3 Comments

  1. Chris

    Big thanks, I was struggling to get sponsorblock working on MeTube (probably more user error than anything else) – your solution finally got me up and running exactly how I wanted!

Leave a Reply to rabbitaim Cancel reply

Your email address will not be published. Required fields are marked *