» · 3.5 · 3.5img · lab8 · ok · qrstuv · sl · subversive

site map

yt-dlp

config

The goal of this yt-dlp configuration file is to save all kinds of information about a video in a somewhat organized matter.

Usage

Save the contents of the code block to a file thats read by yt-dlp. The user configuration [here](https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#configuration) is a good choice.

Change the output path according to your environment. Consider if you really want to use `--ignore-errors`, sometimes it may lead to undesired things. Add languages you are interested in to the `sub-lang` list. English is only really useful if that is the native language of the video.

The below configuration does not make an archive file, add [the param](https://github.com/yt-dlp/yt-dlp#video-selection) if you need it.

If your archive is on a network share or a Copy on Write FS (ZFS, BTRFS), you may want to download to a different storage, and move it over to the right place when completed. Some parameters will make yt-dlp do multiple rounds with processing, reading and rewriting the video file several times. Network shares may make that process slower, and on CoW filesystems this may cause unnecessary fragmentation of free space. When archiving lots of content, along with using an archive file, you may use mergerfs and bash aliases to make your life easier. If you want to script the process, be sure to handle the exit code and the case when multiple yt-dlp's are running in parallel. Solutions to that are welcome in the comments.

Configuration

```
# Output path of video file. Metadata will be placed besides it.
--output "D:\yt-dlp-archive\%(extractor_key)s\%(uploader)s\%(upload_date)s_%(uploader)s_%(title)s_%(resolution)s-%(fps)dfps.%(ext)s"

-f "bestvideo[height<=?1080]+bestaudio/best"

--no-overwrites

--write-description
--write-info-json
--write-comments

--console-title

--merge-output-format mkv

# add metadata to video file
--add-metadata

# dont stop for errors. mostly useful for bulk downloading, e.g. channels and playlists
--ignore-errors

# more retries
--retries 200
--fragment-retries infinite

# more retries, but I think this can cause issues with ignore-errors when youtube has deliberately bugged away a media format
--extractor-retries infinite

--write-sub
--write-auto-sub
--sub-lang en,en-us,live_chat
--sub-format vtt

# embed all kinds of info to the output video file, besides writing them to their respective files
# --embed-metadata implies --embed-chapters
--embed-subs
--embed-metadata
--embed-thumbnail
# keep the thumbnail file. useful for searching in the collection
--write-thumbnail

--prefer-free-formats

--remux-video mkv

-concurrent-fragments 32

# RetryManager does not have a sleep duration by default
--retry-sleep extractor:5

Autogenerate subtitles

```#How to fix autogenerated subtitles

Download subtitle file (and video):
 $ yt-dlp --write-sub --sub-lang en 'url'

Remove every line containing  from sub-file:
 $ cat 'sub-file' | sed '//d' > fixed-subs.vtt