Open FrickTheRIAA opened 4 years ago
Check the Format Selection section in the README.md file. Basically, you can use file extensions to select formats.
For instance, -f bestvideo+bestaudio,m4a
will download and merge bestvideo
and bestaudio
into a single file and download m4a
as a separate file (YouTube serves its AAC files with an .m4a
extension but you can add aac
just in case), while -f bestvideo+bestaudio+m4a
will download and merge the three formats into a single file (in case you don't want to manually remux the file).
If you don't want to type that option every single time you can add it to your configuration file.
Thanks! How do I get it to only download the AAC track when there's an Opus track available for that video though? I don't need an extra copy of the AAC track when there's already an AAC track in the video.
I think you could use a string comparison:
-f bestvideo+bestaudio[ext=webm],m4a/bestvideo+bestaudio
The above example will download the AAC file only if the bestaudio
format happens to have a .webm
extension (i.e. it's a Vorbis or Opus file), otherwise it will just download bestvideo
and bestaudio
and merge them.
You can add as many filters and alternate formats as you want, so toy with that option to see what works best for you.
Checklist
Description
I'd like to get an option added into yt-dlc that will also rip AAC audio and store it in a separate file when the bestvideo+bestaudio profile results in AVC + Opus. This is so that the AAC audio can later be muxed together with the AVC video if needed for compatibility reasons, namely web compatibility and some older hardware not being compatible with Opus. That way I can keep using the best version of the video (AVC + Opus), but if the video gets taken down and I need to change the audio track to AAC for compatibility I can just mux it together with the saved AAC track instead of having to re-encode the Opus track to a lower quality AAC track. This might be a bit niche use case, but I think it would be great for archiving while saving some storage space by not storing the video twice for those videos. Downloading the AAC track separately depending on the video is quite bothersome when it comes to backing up entire YouTube channels.