Metube
Self-hosted video downloader for YouTube and other sites (web UI for youtube-dl / yt-dlp)
Install / Use
/learn @alexta69/MetubeREADME
MeTube
Web GUI for youtube-dl (using the yt-dlp fork) with playlist support. Allows you to download videos from YouTube and dozens of other sites.

🐳 Run using Docker
docker run -d -p 8081:8081 -v /path/to/downloads:/downloads ghcr.io/alexta69/metube
🐳 Run using docker-compose
services:
metube:
image: ghcr.io/alexta69/metube
container_name: metube
restart: unless-stopped
ports:
- "8081:8081"
volumes:
- /path/to/downloads:/downloads
⚙️ Configuration via environment variables
Certain values can be set via environment variables, using the -e parameter on the docker command line, or the environment: section in docker-compose.
⬇️ Download Behavior
- MAX_CONCURRENT_DOWNLOADS: Maximum number of simultaneous downloads allowed. For example, if set to
5, then at most five downloads will run concurrently, and any additional downloads will wait until one of the active downloads completes. Defaults to3. - DELETE_FILE_ON_TRASHCAN: if
true, downloaded files are deleted on the server, when they are trashed from the "Completed" section of the UI. Defaults tofalse. - DEFAULT_OPTION_PLAYLIST_ITEM_LIMIT: Maximum number of playlist items that can be downloaded. Defaults to
0(no limit). - CLEAR_COMPLETED_AFTER: Number of seconds after which completed (and failed) downloads are automatically removed from the "Completed" list. Defaults to
0(disabled).
📁 Storage & Directories
- DOWNLOAD_DIR: Path to where the downloads will be saved. Defaults to
/downloadsin the Docker image, and.otherwise. - AUDIO_DOWNLOAD_DIR: Path to where audio-only downloads will be saved, if you wish to separate them from the video downloads. Defaults to the value of
DOWNLOAD_DIR. - CUSTOM_DIRS: Whether to enable downloading videos into custom directories within the DOWNLOAD_DIR (or AUDIO_DOWNLOAD_DIR). When enabled, a dropdown appears next to the Add button to specify the download directory. Defaults to
true. - CREATE_CUSTOM_DIRS: Whether to support automatically creating directories within the DOWNLOAD_DIR (or AUDIO_DOWNLOAD_DIR) if they do not exist. When enabled, the download directory selector supports free-text input, and the specified directory will be created recursively. Defaults to
true. - CUSTOM_DIRS_EXCLUDE_REGEX: Regular expression to exclude some custom directories from the dropdown. Empty regex disables exclusion. Defaults to
(^|/)[.@].*$, which means directories starting with.or@. - DOWNLOAD_DIRS_INDEXABLE: If
true, the download directories (DOWNLOAD_DIR and AUDIO_DOWNLOAD_DIR) are indexable on the web server. Defaults tofalse. - STATE_DIR: Path to where the queue persistence files will be saved. Defaults to
/downloads/.metubein the Docker image, and.otherwise. - TEMP_DIR: Path where intermediary download files will be saved. Defaults to
/downloadsin the Docker image, and.otherwise.- Set this to an SSD or RAM filesystem (e.g.,
tmpfs) for better performance. - Note: Using a RAM filesystem may prevent downloads from being resumed.
- Set this to an SSD or RAM filesystem (e.g.,
- CHOWN_DIRS: If
false, ownership ofDOWNLOAD_DIR,STATE_DIR, andTEMP_DIR(and their contents) will not be set on container start. Ensure user under which MeTube runs has necessary access to these directories already. Defaults totrue.
📝 File Naming & yt-dlp
- OUTPUT_TEMPLATE: The template for the filenames of the downloaded videos, formatted according to this spec. Defaults to
%(title)s.%(ext)s. - OUTPUT_TEMPLATE_CHAPTER: The template for the filenames of the downloaded videos when split into chapters via postprocessors. Defaults to
%(title)s - %(section_number)s %(section_title)s.%(ext)s. - OUTPUT_TEMPLATE_PLAYLIST: The template for the filenames of the downloaded videos when downloaded as a playlist. Defaults to
%(playlist_title)s/%(title)s.%(ext)s. Set to empty to useOUTPUT_TEMPLATEinstead. - OUTPUT_TEMPLATE_CHANNEL: The template for the filenames of the downloaded videos when downloaded as a channel. Defaults to
%(channel)s/%(title)s.%(ext)s. Set to empty to useOUTPUT_TEMPLATEinstead. - YTDL_OPTIONS: Additional options to pass to yt-dlp in JSON format. See available options here. They roughly correspond to command-line options, though some do not have exact equivalents here. For example,
--recode-videohas to be specified viapostprocessors. Also note that dashes are replaced with underscores. You may find this script helpful for converting from command-line options toYTDL_OPTIONS. - YTDL_OPTIONS_FILE: A path to a JSON file that will be loaded and used for populating
YTDL_OPTIONSabove. Please note that if bothYTDL_OPTIONS_FILEandYTDL_OPTIONSare specified, the options inYTDL_OPTIONStake precedence. The file will be monitored for changes and reloaded automatically when changes are detected.
🌐 Web Server & URLs
- HOST: The host address the web server will bind to. Defaults to
0.0.0.0(all interfaces). - PORT: The port number the web server will listen on. Defaults to
8081. - URL_PREFIX: Base path for the web server (for use when hosting behind a reverse proxy). Defaults to
/. - PUBLIC_HOST_URL: Base URL for the download links shown in the UI for completed files. By default, MeTube serves them under its own URL. If your download directory is accessible on another URL and you want the download links to be based there, use this variable to set it.
- PUBLIC_HOST_AUDIO_URL: Same as PUBLIC_HOST_URL but for audio downloads.
- HTTPS: Use
httpsinstead ofhttp(CERTFILE and KEYFILE required). Defaults tofalse. - CERTFILE: HTTPS certificate file path.
- KEYFILE: HTTPS key file path.
- ROBOTS_TXT: A path to a
robots.txtfile mounted in the container.
🏠 Basic Setup
- PUID: User under which MeTube will run. Defaults to
1000(legacyUIDalso supported). - PGID: Group under which MeTube will run. Defaults to
1000(legacyGIDalso supported). - UMASK: Umask value used by MeTube. Defaults to
022. - DEFAULT_THEME: Default theme to use for the UI, can be set to
light,dark, orauto. Defaults toauto. - LOGLEVEL: Log level, can be set to
DEBUG,INFO,WARNING,ERROR,CRITICAL, orNONE. Defaults toINFO. - ENABLE_ACCESSLOG: Whether to enable access log. Defaults to
false.
The project's Wiki contains examples of useful configurations contributed by users of MeTube:
🍪 Using browser cookies
In case you need to use your browser's cookies with MeTube, for example to download restricted or private videos:
- Install in your browser an extension to extract cookies:
- Extract the cookies you need with the extension and save/export them as
cookies.txt. - In MeTube, open Advanced Options and use the Upload Cookies button to upload the file.
- After upload, the cookie indicator should show as active.
- Use Delete Cookies in the same section to remove uploaded cookies.
🔌 Browser extensions
Browser extensions allow right-clicking videos and sending them directly to MeTube. Please note that if you're on an HTTPS page, your MeTube instance must be behind an HTTPS reverse proxy (see below) for the extensions to work.
Chrome: contributed by Rpsl. You can install it from Google Chrome Webstore or use developer mode and install from sources.
Firefox: contributed by nanocortex. You can install it from Firefox Addons or get sources from here.
📱 iOS Shortcut
rithask created an iOS shortcut to send URLs to MeTube from Safari. Enter the MeTube instance address when prompted which will be saved for later use. You can run the shortcut from Safari’s share menu. The shortcut can be downloaded from this iCloud link.
📱 iOS Compatibility
iOS has strict requirements for video files, requiring h264 or h265 video codec and aac audio codec in MP4 container. This can sometimes be a lower quality than the best quality available. To accommodate iOS requirements, when downloading a MP4 format you can choose "Best (iOS)" to get the best quality formats as compatible as possible with iOS requirements.
To force all downloads to be converted to an iOS-compatible codec, insert this as an environment variable:
environment:
- 'YTDL_OPTIONS={"format": "best", "exec": "ffmpeg -i %(filepath)q -c:v libx264 -c:a aac %(filepath)q.h264.mp4"}'
🔖 Bookmarklet
kushfest has created a Chrome bookmarklet for
