# set sane defaults to ensure video and audio are saved as intended # # Unfortunately yt-dlp lacks sane behaviors with regards to controlling # both video and audio formats from `~/.config/yt-dlp/config`. # # If I add `--recode-video=webm` then it will also recode audio only downloads # to webm even if I specified `--audio-format=opus`. # # I then tried using `-f` to control the downloaded file, but this is exposed # other strange and undesirable behaviors. # # If I use `ba[ext=opus]` it will often fail because `opus` is not a commonly # available extension. # # If I use `ba[ext=webm]`even if I want both audio and video it will never # download the full video file. # # If I use `bv[ext=webm]+ba[ext=webm]` with `-x` it will download the entire # video file, which is often an order of magnitude larger wasting both time and # disk space, before converting to the desired audio-only format. # # In conclusion there does not seem to be intelligent design around the `-x` # flag. It ignores this flag when picking the file to download, and it ignores # this flag when asked to recode video even though I only want audio. # # The end result is that I have to pick between only controlling audio or video # and if I control video I am forced to download entire video files when smaller # audio-only downloads would suffice. # sane stream download setting --wait-for-video=1 # optimal quality --audio-quality=0 # save audio as opus and video as webm --prefer-free-formats -S ext:webm:webm --audio-format=opus --recode-video="opus>opus/webm"