I have a yt-dlp command running daily to download any new Youtube videos from a few channels. I don't want to keep the videos around forever, so I use --download-archive
to prevent redownloads if I delete or move a video:
yt-dlp --continue --no-overwrites --ignore-errors --download-archive archive.txt \
-o "%(channel)s [%(channel_id)s] -- %(title)s-[%(id)s] [%(resolution)s].%(ext)s" $CHANNELS
However, sometimes the videos are still being processed by Youtube, so yt-dlp downloads the low-resolution version that is available.
How can I force yt-dlp to redownload better qualities as they become available, while still being able to delete videos without triggering redownloads?
If I remove the --download-archive
, yt-dlp will automatically download the better quality because the filename will be different (%(resolution)s
in the format). But this will redownload videos I deleted.
If I keep --download-archive
, yt-dlp won't redownload deleted videos, but won't download better qualities as they become available either.
Can I perhaps save both video ID and resolution in the archive keys? Or hook a pre-processing script to decide when to download? I'm ok with some level of redownloads, for example if I delete a low resolution video.
I solved my problem with the --match-filters
flag. More specifically, adding a resolution height filter:
--match-filters "height>=?720"
This filter skips videos smaller than 720p, while still allowing videos with unknown size (the ?
part of >=?
).
This way, low-resolution videos are skipped entirely and not committed to the archive, but it automatically downloads the high-resolution version when it becomes available. The downside is that videos that are only ever available at low resolution won't be downloaded, but that's not a problem for my use case.
I also tried -f '[height>=?720]'
, which should work according to the documentation, but for some reason kept getting Requested format is not available
errors.