1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 22: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

@ -633,6 +633,8 @@ But sometimes you may want to download in a different format, for example when y
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).
The simplest case is requesting a specific format, for example with `-f 22` you can download the format with format code equal to 22. You can get the list of available format codes for particular video using `--list-formats` or `-F`. Note that these format codes are extractor specific.