From dd487fa4cbad25b58b79ecf3a9d700b560e5fb83 Mon Sep 17 00:00:00 2001 From: Producer Matt Date: Sun, 22 Dec 2019 19:20:06 -0600 Subject: [PATCH] README.md: clarify how to combine + and / A while back I wanted to use both merging and precedence in format selection. I encountered complaints from the program and eventually figured out I was doing it backwards. I was trying things like this: `-f 136/mp4/bestvideo+140/m4a/bestaudio` When what I needed to do was: `-f 136+140/mp4+m4a/bestvideo+bestaudio` I wrote two lines to try to clarify this. I hope this is ok. --Matt --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 01f975958..bc79c7e45 100644 --- a/README.md +++ b/README.md @@ -684,7 +684,7 @@ Note that none of the aforementioned meta fields are guaranteed to be present si Formats for which the value is not known are excluded unless you put a question mark (`?`) after the operator. You can combine format filters, so `-f "[height <=? 720][tbr>500]"` selects up to 720p videos (or videos where the height is not known) with a bitrate of at least 500 KBit/s. -You can merge the video and audio of two formats into a single file using `-f +` (requires ffmpeg or avconv installed), for example `-f bestvideo+bestaudio` will download the best video-only format, the best audio-only format and mux them together with ffmpeg/avconv. +You can merge the video and audio of two formats into a single file using `-f +` (requires ffmpeg or avconv installed), for example `-f bestvideo+bestaudio` will download the best video-only format, the best audio-only format and mux them together with ffmpeg/avconv. If you want to merge video and audio formats with precedence, group the video and audio together with `+` and then use `/`, for example `-f 136+140/mp4+m4a/bestvideo+bestaudio`. Format selectors can also be grouped using parentheses, for example if you want to download the best mp4 and webm formats with a height lower than 480 you can use `-f '(mp4,webm)[height<480]'`. @@ -706,6 +706,9 @@ $ youtube-dl -f 'bestvideo[height<=480]+bestaudio/best[height<=480]' # Download best video only format but no bigger than 50 MB $ youtube-dl -f 'best[filesize<50M]' +# Download preferred formats, with merge and precedence +$ youtube-dl -f '136+140/mp4+m4a/bestvideo+bestaudio' + # Download best format available via direct link over HTTP/HTTPS protocol $ youtube-dl -f '(bestvideo+bestaudio/best)[protocol^=http]'