YouTube on your media server (kinda)

yt

Media Server:

  • Jellyfin, Plex, Emby: Add a Video Library called “YouTube.”

Services:

  • Metube: Retrieves individual videos.
  • ChannelTube: Fetches the latest videos from a specific channel.

Folder Structure

  • /data/media/youtube - Directory for ChannelTube.
  • /data/media/youtube/metube - Directory for Metube to download videos.

Note: ChannelTube will create a folder for each added channel, using the channel name as the folder name.

Add each channel as a separate location in your YouTube Library on your Jellyfin/Plex server. This will ensure all videos appear without displaying subfolders.

YAML Configuration

services:
  metube:
    image: ghcr.io/alexta69/metube
    container_name: metube
    environment:
      - AUDIO_DOWNLOAD_DIR=/data/media/music/singles
      - DOWNLOAD_DIR=/data/media/youtube/metube
      - STATE_DIR=/config/state
      - TEMP_DIR=/config/temp
      - OUTPUT_TEMPLATE=%(title)s.%(ext)s
      - YTDL_OPTIONS={"writethumbnail":true,"postprocessors":[{"key":"EmbedThumbnail"},{"key":"FFmpegMetadata"}],"updatetime":false}
    ports:
      - xxxx:8081
    volumes:
      - /data/media/youtube/metube:/data/media/youtube/metube
      - /data/media/music/singles:/data/media/music/singles
      - /path/to/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

  channeltube:
    image: thewicklowwolf/channeltube:latest
    container_name: channeltube
    volumes:
      - /path/to/config:/channeltube/config
      - /data/media/youtube:/channeltube/downloads
      - /etc/localtime:/etc/localtime:ro 
    ports:
      - xxxx:5000
    restart: unless-stopped

Notes

ChannelTube:

  • Integrated SponsorBlock.
  • Option to specify cookies.
  • Ability to defer processing, such as waiting until a new video is older than 30 minutes.
    • defer_hours: Set to 0.5.
  • Configurable quality settings with a fallback to the best available:
    • video_format_id: Set to 625 for 4K resolution.

Metube:

  • Option to specify cookies.
  • Supports separate directories for music and videos.

Bonus #1

You can integrate Metube as a channel in ChannelTube with the following settings:

Channel Name: metube
Channel Link: # use an actual channel
Days to Sync: 0
Days to keep: 60

ChannelTube will now monitor the folder /data/media/youtube/metube and automatically delete videos older than 60 days.

Written on 25 July 2024