1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 18:57:20 +08:00

Clarified format selection merging behaviour in readme

I was having strange behaviour where downloading from youtube, sometimes could not merge the audio and video streams without making it matroska, even though I asked for mp4.  I found I can work around this by explicitly stating both desired audio and video format, since apparently passing `-f mp4` only specifies the desired video format, and does not try to transcode audio to this format.
This commit is contained in:
awiebe 2018-07-22 22:00:40 -07:00 committed by GitHub
parent d4e7065111
commit 393bc1ecf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -631,7 +631,9 @@ By default youtube-dl tries to download the best available quality, i.e. if you
But sometimes you may want to download in a different format, for example when you are on a slow or intermittent connection. The key mechanism for achieving this is so-called *format selection* based on which you can explicitly specify desired format, select formats based on some criterion or criteria, setup precedence and much more.
The general syntax for format selection is `--format FORMAT` or shorter `-f FORMAT` where `FORMAT` is a *selector expression*, i.e. an expression that describes format or formats you would like to download.
The general syntax for format selection is `--format FORMAT` or shorter `-f FORMAT` where `FORMAT` is a *selector expression*, i.e. an expression that describes format or formats you would like to download.
To avoid the case where the audio and video are incompatible, specify both the format of the audio and video streams explicitly. For example specifying `-f mp4` will default to `-f mp4,best`, but the best audio youtube can provide cannot be contained in an `MP4` file, so youtube-dl will try to merge them into an `mkv` instead of the requested `mp4` format. To avoid this, specify `-f mp4,mp4`, so the audio and video are compatible.
**tl;dr:** [navigate me to examples](#format-selection-examples).