X-Git-Url: https://jfr.im/git/yt-dlp.git/blobdiff_plain/12ae240c3654f5119adee739f0aea90d3f47d690..a26c99ac13e307bdfe7889739777b022866d2cff:/README.md diff --git a/README.md b/README.md index 08bddaa18..670c07d39 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,110 @@ -[![Build Status](https://travis-ci.com/blackjack4494/yt-dlc.svg?branch=master)](https://travis-ci.com/blackjack4494/yt-dlc) -[![PyPi](https://img.shields.io/pypi/v/youtube-dlc.svg)](https://pypi.org/project/youtube-dlc) -[![Downloads](https://pepy.tech/badge/youtube-dlc)](https://pepy.tech/project/youtube-dlc) - -[![Gitter chat](https://img.shields.io/gitter/room/youtube-dlc/community)](https://gitter.im/youtube-dlc) -[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](https://github.com/blackjack4494/youtube-dlc/blob/master/LICENSE) - -youtube-dlc - download videos from youtube.com or other video platforms. - -youtube-dlc is a fork of youtube-dl with the intention of getting features tested by the community merged in the tool faster, since youtube-dl's development seems to be slowing down. (https://web.archive.org/web/20201014194602/https://github.com/ytdl-org/youtube-dl/issues/26462) - -- [INSTALLATION](#installation) -- [DESCRIPTION](#description) -- [OPTIONS](#options) - - [Network Options:](#network-options) - - [Geo Restriction:](#geo-restriction) - - [Video Selection:](#video-selection) - - [Download Options:](#download-options) - - [Filesystem Options:](#filesystem-options) - - [Thumbnail images:](#thumbnail-images) - - [Verbosity / Simulation Options:](#verbosity--simulation-options) - - [Workarounds:](#workarounds) - - [Video Format Options:](#video-format-options) - - [Subtitle Options:](#subtitle-options) - - [Authentication Options:](#authentication-options) - - [Adobe Pass Options:](#adobe-pass-options) - - [Post-processing Options:](#post-processing-options) - - [Extractor Options:](#extractor-options) -- [CONFIGURATION](#configuration) - - [Authentication with `.netrc` file](#authentication-with-netrc-file) -- [OUTPUT TEMPLATE](#output-template) - - [Output template and Windows batch files](#output-template-and-windows-batch-files) - - [Output template examples](#output-template-examples) -- [FORMAT SELECTION](#format-selection) - - [Format selection examples](#format-selection-examples) -- [VIDEO SELECTION](#video-selection-1) +[![Build Status](https://github.com/pukkandan/yt-dlc/workflows/CI/badge.svg?branch=master)](https://github.com/pukkandan/yt-dlc/actions?query=workflow%3ACI) +[![Release Version](https://img.shields.io/badge/Release-2021.01.07-1-brightgreen)](https://github.com/pukkandan/yt-dlc/releases/latest) +[![License: Unlicense](https://img.shields.io/badge/License-Unlicense-blue.svg)](https://github.com/pukkandan/yt-dlc/blob/master/LICENSE) + +youtube-dlc - download videos from youtube.com and many other [video platforms](docs/supportedsites.md) + +This is a fork of [youtube-dlc](https://github.com/blackjack4494/yt-dlc) which is inturn a fork of [youtube-dl](https://github.com/ytdl-org/youtube-dl) + +* [CHANGES FROM YOUTUBE-DLC](#changes) +* [INSTALLATION](#installation) + * [UPDATE](#update) + * [COMPILE](#compile) +* [YOUTUBE-DLC](#youtube-dlc) +* [DESCRIPTION](#description) +* [OPTIONS](#options) + * [Network Options](#network-options) + * [Geo Restriction](#geo-restriction) + * [Video Selection](#video-selection) + * [Download Options](#download-options) + * [Filesystem Options](#filesystem-options) + * [Thumbnail images](#thumbnail-images) + * [Internet Shortcut Options](#internet-shortcut-options) + * [Verbosity / Simulation Options](#verbosity--simulation-options) + * [Workarounds](#workarounds) + * [Video Format Options](#video-format-options) + * [Subtitle Options](#subtitle-options) + * [Authentication Options](#authentication-options) + * [Adobe Pass Options](#adobe-pass-options) + * [Post-processing Options](#post-processing-options) + * [SponSkrub Options (SponsorBlock)](#sponskrub-options-sponsorblock) + * [Extractor Options](#extractor-options) +* [CONFIGURATION](#configuration) + * [Authentication with .netrc file](#authentication-with-netrc-file) +* [OUTPUT TEMPLATE](#output-template) + * [Output template and Windows batch files](#output-template-and-windows-batch-files) + * [Output template examples](#output-template-examples) +* [FORMAT SELECTION](#format-selection) + * [Filtering Formats](#filtering-formats) + * [Sorting Formats](#sorting-formats) + * [Format Selection examples](#format-selection-examples) +* [VIDEO SELECTION](#video-selection-1) +* [MORE](#more) + + +# CHANGES +See [commits](https://github.com/pukkandan/yt-dlc/commits) for more details + +### 2021.01.05 +* **Format Sort:** Added `--format-sort` (`-S`), `--format-sort-force` (`--S-force`) - See [Sorting Formats](#sorting-formats) for details +* **Format Selection:** See [Format Selection](#format-selection) for details + * New format selectors: `best*`, `worst*`, `bestvideo*`, `bestaudio*`, `worstvideo*`, `worstaudio*` + * Changed video format sorting to show video only files and video+audio files together. + * Added `--video-multistreams`, `--no-video-multistreams`, `--audio-multistreams`, `--no-audio-multistreams` + * Added `b`,`w`,`v`,`a` as alias for `best`, `worst`, `video` and `audio` respectively +* **Shortcut Options:** Added `--write-link`, `--write-url-link`, `--write-webloc-link`, `--write-desktop-link` by @h-h-h-h - See [Internet Shortcut Options](#internet-shortcut-options) for details +* **Sponskrub integration:** Added `--sponskrub`, `--sponskrub-cut`, `--sponskrub-force`, `--sponskrub-location`, `--sponskrub-args` - See [SponSkrub Options](#sponskrub-options-sponsorblock) for details +* Added `--force-download-archive` (`--force-write-archive`) by by h-h-h-h +* Added `--list-formats-as-table`, `--list-formats-old` +* **Negative Options:** Makes it possible to negate boolean options by adding a `no-` to the switch + * Added `--no-ignore-dynamic-mpd`, `--no-allow-dynamic-mpd`, `--allow-dynamic-mpd`, `--youtube-include-hls-manifest`, `--no-youtube-include-hls-manifest`, `--no-youtube-skip-hls-manifest`, `--no-download`, `--no-download-archive`, `--resize-buffer`, `--part`, `--mtime`, `--no-keep-fragments`, `--no-cookies`, `--no-write-annotations`, `--no-write-info-json`, `--no-write-description`, `--no-write-thumbnail`, `--youtube-include-dash-manifest`, `--post-overwrites`, `--no-keep-video`, `--no-embed-subs`, `--no-embed-thumbnail`, `--no-add-metadata`, `--no-include-ads`, `--no-write-sub`, `--no-write-auto-sub`, `--no-playlist-reverse`, `--no-restrict-filenames`, `--youtube-include-dash-manifest`, `--no-format-sort-force`, `--flat-videos`, `--no-list-formats-as-table`, `--no-sponskrub`, `--no-sponskrub-cut`, `--no-sponskrub-force` + * Renamed: `--write-subs`, `--no-write-subs`, `--no-write-auto-subs`, `--write-auto-subs`. Note that these can still be used without the ending "s" +* Relaxed validation for format filters so that any arbitrary field can be used +* Fix for embedding thumbnail in mp3 by @pauldubois98 +* Make Twitch Video ID output from Playlist and VOD extractor same. This is only a temporary fix +* **Merge youtube-dl:** Upto [2020.01.03](https://github.com/ytdl-org/youtube-dl/commit/8e953dcbb10a1a42f4e12e4e132657cb0100a1f8) - See [blackjack4494/yt-dlc#280](https://github.com/blackjack4494/yt-dlc/pull/280) for details +* Cleaned up the fork for public use + +### 2021.01.05-1 +* **Changed defaults:** + * Enabled `--ignore` + * Disabled `--video-multistreams` and `--audio-multistreams` + * Changed default format selection to `bv*+ba/b` when `--audio-multistreams` is disabled + * Changed default format sort order to `res,fps,codec,size,br,asr,proto,ext,has_audio,source,format_id` + * Changed `webm` to be more preferable than `flv` in format sorting + * Changed default output template to `%(title)s [%(id)s].%(ext)s` + * Enabled `--list-formats-as-table` + +### 2021.01.07 +* Removed priority of `av01` codec in `-S` since most devices don't support it yet +* Added `duration_string` to be used in `--output` +* Created First Release + +### 2021.01.07-1 +* [Akamai] fix by @nixxo +* [Tiktok] fix extractor by @GreyAlien502 +* [vlive] add support for playlists by @kyuyeunk +* [youtube_live_chat] make sure playerOffsetMs is positive by @siikamiika +* Ignore extra data streams in ffmpeg by @jbruchon +* Allow passing different arguments to different postprocessors using `--postprocessor-args` +* Deprecated `--sponskrub-args`. The same can now be done using `--postprocessor-args "sponskrub:"` -# INSTALLATION -[How to update](#update) - -**All Platforms** -Preferred way using pip: -You may want to use `python3` instead of `python` - python -m pip install --upgrade youtube-dlc - -**UNIX** (Linux, macOS, etc.) -Using wget: +# INSTALLATION - sudo wget https://github.com/blackjack4494/yt-dlc/releases/latest/download/youtube-dlc -O /usr/local/bin/youtube-dlc - sudo chmod a+rx /usr/local/bin/youtube-dlc +To use the latest version, simply download and run the [latest release](https://github.com/pukkandan/yt-dlc/releases/latest). +Currently, there is no support for any package managers. -Using curl: +If you want to install the current master branch - sudo curl -L https://github.com/blackjack4494/yt-dlc/releases/latest/download/youtube-dlc -o /usr/local/bin/youtube-dlc - sudo chmod a+rx /usr/local/bin/youtube-dlc + python -m pip install git+https://github.com/pukkandan/yt-dlc +### UPDATE +**DO NOT UPDATE using `-U` !** instead download binaries again -**Windows** users can download [youtube-dlc.exe](https://github.com/blackjack4494/yt-dlc/releases/latest/download/youtube-dlc.exe) (**do not** put in `C:\Windows\System32`!). +### COMPILE -**Compile** +**For Windows**: To build the Windows executable yourself (without version info!) python -m pip install --upgrade pyinstaller @@ -70,7 +116,7 @@ # INSTALLATION New way to build Windows is to use `python pyinst.py` (please use python3 64Bit) For 32Bit Version use a 32Bit Version of python (3 preferred here as well) and run `python pyinst32.py` -For Unix: +**For Unix**: You will need the required build tools python, make (GNU), pandoc, zip, nosetests Then simply type this @@ -78,26 +124,27 @@ # INSTALLATION make -# UPDATE -**DO NOT UPDATE using `-U` !** instead download binaries again or when installed with pip use a described above when installing. -I will add some memorable short links to the binaries so you can download them easier. - # DESCRIPTION **youtube-dlc** is a command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform specific. It should work on your Unix box, on Windows or on macOS. It is released to the public domain, which means you can modify it, redistribute it or use it however you like. youtube-dlc [OPTIONS] URL [URL...] + # OPTIONS +`Ctrl+F` is your friend :D + + +## General Options: -h, --help Print this help text and exit --version Print program version and exit - -U, --update Update this program to latest version. Make - sure that you have sufficient permissions - (run with sudo if needed) + -U, --update [BROKEN] Update this program to latest + version. Make sure that you have sufficient + permissions (run with sudo if needed) -i, --ignore-errors Continue on download errors, for example to skip unavailable videos in a playlist - --abort-on-error Abort downloading of further videos (in the - playlist or the command line) if an error - occurs + (default) (Same as --no-abort-on-error) + --abort-on-error Abort downloading of further videos if an + error occurs (Same as --no-ignore-errors) --dump-user-agent Display the current browser identification --list-extractors List all supported extractors --extractor-descriptions Output descriptions of all supported @@ -106,26 +153,28 @@ # OPTIONS extractor --default-search PREFIX Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos - from google videos for youtube-dlc "large + from google videos for youtube-dl "large apple". Use the value "auto" to let - youtube-dlc guess ("auto_warning" to emit a + youtube-dl guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching. - --ignore-config Do not read configuration files. When given + --ignore-config, --no-config Do not read configuration files. When given in the global configuration file - /etc/youtube-dlc.conf: Do not read the user + /etc/youtube-dl.conf: Do not read the user configuration in ~/.config/youtube- - dlc/config (%APPDATA%/youtube- - dlc/config.txt on Windows) + dl/config (%APPDATA%/youtube-dl/config.txt + on Windows) --config-location PATH Location of the configuration file; either the path to the config or its containing directory. --flat-playlist Do not extract the videos of a playlist, only list them. + --flat-videos Do not resolve the video urls + --no-flat-playlist Extract the videos of a playlist --mark-watched Mark videos watched (YouTube only) - --no-mark-watched Do not mark videos watched (YouTube only) + --no-mark-watched Do not mark videos watched --no-color Do not emit color codes in output ## Network Options: @@ -176,11 +225,15 @@ ## Video Selection: SIZE (e.g. 50k or 44.6m) --max-filesize SIZE Do not download any videos larger than SIZE (e.g. 50k or 44.6m) - --date DATE Download only videos uploaded in this date + --date DATE Download only videos uploaded in this date. + The date can be "YYYYMMDD" or in the format + "(now|today)[+-][0-9](day|week|month|year)(s)?" --datebefore DATE Download only videos uploaded on or before - this date (i.e. inclusive) + this date. The date formats accepted is the + same as --date --dateafter DATE Download only videos uploaded on or after - this date (i.e. inclusive) + this date. The date formats accepted is the + same as --date --min-views COUNT Do not download any videos with less than COUNT views --max-views COUNT Do not download any videos with more than @@ -204,6 +257,7 @@ ## Video Selection: service), but who also have a description, use --match-filter "like_count > 100 & dislike_count ++...` (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 `--no-video-multistreams` is used, all formats with a video stream except the first one are ignored. Similarly, if `--no-audio-multistreams` is used, all formats with an audio stream except the first one are ignored. For example, `-f bestvideo+best+bestaudio` will download and merge all 3 given formats. The resulting file will have 2 video streams and 2 audio streams. But `-f bestvideo+best+bestaudio --no-video-multistreams` will download and merge only `bestvideo` and `bestaudio`. `best` is ignored since another format containing a video stream (`bestvideo`) has already been selected. The order of the formats is therefore important. `-f best+bestaudio --no-audio-multistreams` will download and merge both formats while `-f bestaudio+best --no-audio-multistreams` will ignore `best` and download only `bestaudio`. + +## Filtering Formats + You can also filter the video formats by putting a condition in brackets, as in `-f "best[height=720]"` (or `-f "[filesize>10M]"`). The following numeric meta fields can be used with comparisons `<`, `<=`, `>`, `>=`, `=` (equals), `!=` (not equals): @@ -728,60 +889,173 @@ # FORMAT SELECTION - `container`: Name of the container format - `protocol`: The protocol that will be used for the actual download, lower-case (`http`, `https`, `rtsp`, `rtmp`, `rtmpe`, `mms`, `f4m`, `ism`, `http_dash_segments`, `m3u8`, or `m3u8_native`) - `format_id`: A short description of the format + - `language`: Language code Any string comparison may be prefixed with negation `!` in order to produce an opposite comparison, e.g. `!*=` (does not contain). -Note that none of the aforementioned meta fields are guaranteed to be present since this solely depends on the metadata obtained by particular extractor, i.e. the metadata offered by the video hoster. +Note that none of the aforementioned meta fields are guaranteed to be present since this solely depends on the metadata obtained by particular extractor, i.e. the metadata offered by the video hoster. Any other field made available by the extractor can also be used for filtering. 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. - 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]'`. -Since the end of April 2015 and version 2015.04.26, youtube-dlc uses `-f bestvideo+bestaudio/best` as the default format selection (see [#5447](https://github.com/ytdl-org/youtube-dl/issues/5447), [#5456](https://github.com/ytdl-org/youtube-dl/issues/5456)). If ffmpeg or avconv are installed this results in downloading `bestvideo` and `bestaudio` separately and muxing them together into a single file giving the best overall quality available. Otherwise it falls back to `best` and results in downloading the best available quality served as a single file. `best` is also needed for videos that don't come from YouTube because they don't provide the audio and video in two different files. If you want to only download some DASH formats (for example if you are not interested in getting videos with a resolution higher than 1080p), you can add `-f bestvideo[height<=?1080]+bestaudio/best` to your configuration file. Note that if you use youtube-dlc to stream to `stdout` (and most likely to pipe it to your media player then), i.e. you explicitly specify output template as `-o -`, youtube-dlc still uses `-f best` format selection in order to start content delivery immediately to your player and not to wait until `bestvideo` and `bestaudio` are downloaded and muxed. - -If you want to preserve the old format selection behavior (prior to youtube-dlc 2015.04.26), i.e. you want to download the best available quality media served as a single file, you should explicitly specify your choice with `-f best`. You may want to add it to the [configuration file](#configuration) in order not to type it every time you run youtube-dlc. - -#### Format selection examples +## Sorting Formats + +You can change the criteria for being considered the `best` by using `-S` (`--format-sort`). The general format for this is `--format-sort field1,field2...`. The available fields are: + + - `video`, `has_video`: Gives priority to formats that has a video stream + - `audio`, `has_audio`: Gives priority to formats that has a audio stream + - `extractor`, `preference`, `extractor_preference`: The format preference as given by the extractor + - `lang`, `language_preference`: Language preference as given by the extractor + - `quality`: The quality of the format. This is a metadata field available in some websites + - `source`, `source_preference`: Preference of the source as given by the extractor + - `proto`, `protocol`: Protocol used for download (`https`/`ftps` > `http`/`ftp` > `m3u8-native` > `m3u8` > `http-dash-segments` > other > `mms`/`rtsp` > unknown > `f4f`/`f4m`) + - `vcodec`, `video_codec`: Video Codec (`vp9` > `h265` > `h264` > `vp8` > `h263` > `theora` > other > unknown) + - `acodec`, `audio_codec`: Audio Codec (`opus` > `vorbis` > `aac` > `mp4a` > `mp3` > `ac3` > `dts` > other > unknown) + - `codec`: Equivalent to `vcodec,acodec` + - `vext`, `video_ext`: Video Extension (`mp4` > `webm` > `flv` > other > unknown). If `--prefer-free-formats` is used, `webm` is prefered. + - `aext`, `audio_ext`: Audio Extension (`m4a` > `aac` > `mp3` > `ogg` > `opus` > `webm` > other > unknown). If `--prefer-free-formats` is used, the order changes to `opus` > `ogg` > `webm` > `m4a` > `mp3` > `aac`. + - `ext`, `extension`: Equivalent to `vext,aext` + - `filesize`: Exact filesize, if know in advance. This will be unavailable for mu38 and DASH formats. + - `filesize_approx`: Approximate filesize calculated from the manifests + - `size`, `filesize_estimate`: Exact filesize if available, otherwise approximate filesize + - `height`: Height of video + - `width`: Width of video + - `res`, `dimension`: Video resolution, calculated as the smallest dimension. + - `fps`, `framerate`: Framerate of video + - `tbr`, `total_bitrate`: Total average bitrate in KBit/s + - `vbr`, `video_bitrate`: Average video bitrate in KBit/s + - `abr`, `audio_bitrate`: Average audio bitrate in KBit/s + - `br`, `bitrate`: Equivalent to using `tbr,vbr,abr` + - `samplerate`, `asr`: Audio sample rate in Hz + +Note that any other **numerical** field made available by the extractor can also be used. All fields, unless specified otherwise, are sorted in decending order. To reverse this, prefix the field with a `+`. Eg: `+res` prefers format with the smallest resolution. Additionally, you can suffix a prefered value for the fields, seperated by a `:`. Eg: `res:720` prefers larger videos, but no larger than 720p and the smallest video if there are no videos less than 720p. For `codec` and `ext`, you can provide two prefered values, the first for video and the second for audio. Eg: `+codec:avc:m4a` (equivalent to `+vcodec:avc,+acodec:m4a`) sets the video codec preference to `h264` > `h265` > `vp9` > `vp8` > `h263` > `theora` and audio codec preference to `mp4a` > `aac` > `vorbis` > `opus` > `mp3` > `ac3` > `dts`. You can also make the sorting prefer the nearest values to the provided by using `~` as the delimiter. Eg: `filesize~1G` prefers the format with filesize closest to 1 GiB. + +The fields `has_video`, `extractor`, `lang`, `quality` are always given highest priority in sorting, irrespective of the user-defined order. This behaviour can be changed by using `--force-format-sort`. Apart from these, the default order used is: `res,fps,codec,size,br,asr,proto,ext,has_audio,source,format_id`. Note that the extractors may override this default order, but they cannot override the user-provided order. + +If your format selector is `worst`, the last item is selected after sorting. This means it will select the format that is worst in all repects. Most of the time, what you actually want is the video with the smallest filesize instead. So it is generally better to use `-f best -S +size,+br,+res,+fps`. + +**Tip**: You can use the `-v -F` to see how the formats have been sorted (worst to best). + +## Format Selection examples Note that on Windows you may need to use double quotes instead of single. ```bash -# Download best mp4 format available or any other best if no mp4 available -$ youtube-dlc -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' +# Download and merge the best best video-only format and the best audio-only format, +# or download the best combined format if video-only format is not available +$ youtube-dlc -f 'bv+ba/b' -# Download best format available but no better than 480p -$ youtube-dlc -f 'bestvideo[height<=480]+bestaudio/best[height<=480]' +# Download best format that contains video, +# and if it doesn't already have an audio stream, merge it with best audio-only format +$ youtube-dlc -f 'bv*+ba/b' -# Download best video only format but no bigger than 50 MB -$ youtube-dlc -f 'best[filesize<50M]' +# Same as above +$ youtube-dlc -# Download best format available via direct link over HTTP/HTTPS protocol -$ youtube-dlc -f '(bestvideo+bestaudio/best)[protocol^=http]' -# Download the best video format and the best audio format without merging them -$ youtube-dlc -f 'bestvideo,bestaudio' -o '%(title)s.f%(format_id)s.%(ext)s' -``` -Note that in the last example, an output template is recommended as bestvideo and bestaudio may have the same file name. +# Download the worst video available +$ youtube-dlc -f 'wv*+wa/w' -# VIDEO SELECTION +# Download the best video available but with the smallest resolution +$ youtube-dlc -S '+res' -Videos can be filtered by their upload date using the options `--date`, `--datebefore` or `--dateafter`. They accept dates in two formats: +# Download the smallest video available +$ youtube-dlc -S '+size,+bitrate' - - Absolute dates: Dates in the format `YYYYMMDD`. - - Relative dates: Dates in the format `(now|today)[+-][0-9](day|week|month|year)(s)?` - -Examples: -```bash -# Download only the videos uploaded in the last 6 months -$ youtube-dlc --dateafter now-6months -# Download only the videos uploaded on January 1, 1970 -$ youtube-dlc --date 19700101 +# Download the best mp4 video available, or the best video if no mp4 available +$ youtube-dlc -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' + +# Download the best video with the best extension +# (For video, mp4 > webm > flv. For audio, m4a > aac > mp3 ...) +$ youtube-dlc -S 'ext' + + + +# Download the best video available but no better than 480p, +# or the worst video if there is no video under 480p +$ youtube-dlc -f 'bv*[height<=480]+ba/b[height<=480] / wv*+ba/w' + +# Download the best video available with the largest height but no better than 480p, +# or the best video with the smallest resolution if there is no video under 480p +$ youtube-dlc -S 'height:480' + +# Download the best video available with the largest resolution but no better than 480p, +# or the best video with the smallest resolution if there is no video under 480p +# Resolution is determined by using the smallest dimension. +# So this works correctly for vertical videos as well +$ youtube-dlc -S 'res:480' + -$ # Download only the videos uploaded in the 200x decade -$ youtube-dlc --dateafter 20000101 --datebefore 20091231 + +# Download the best video (that also has audio) but no bigger than 50 MB, +# or the worst video (that also has audio) if there is no video under 50 MB +$ youtube-dlc -f 'b[filesize<50M] / w' + +# Download largest video (that also has audio) but no bigger than 50 MB, +# or the smallest video (that also has audio) if there is no video under 50 MB +$ youtube-dlc -f 'b' -S 'filesize:50M' + +# Download best video (that also has audio) that is closest in size to 50 MB +$ youtube-dlc -f 'b' -S 'filesize~50M' + + + +# Download best video available via direct link over HTTP/HTTPS protocol, +# or the best video available via any protocol if there is no such video +$ youtube-dlc -f '(bv*+ba/b)[protocol^=http][protocol!*=dash] / (bv*+ba/b)' + +# Download best video available via the best protocol +# (https/ftps > http/ftp > m3u8_native > m3u8 > http_dash_segments ...) +$ youtube-dlc -S 'protocol' + + + +# Download the best video-only format and the best audio-only format without merging them +# For this case, an output template should be used since +# by default, bestvideo and bestaudio will have the same file name. +$ youtube-dlc -f 'bv,ba' -o '%(title)s.f%(format_id)s.%(ext)s' + + + +# Download the best video with h264 codec, or the best video if there is no such video +$ youtube-dlc -f '(bv*+ba/b)[vcodec^=avc1] / (bv*+ba/b)' + +# Download the best video with best codec no better than h264, +# or the best video with worst codec if there is no such video +$ youtube-dlc -S 'codec:h264' + +# Download the best video with worst codec no worse than h264, +# or the best video with best codec if there is no such video +$ youtube-dlc -S '+codec:h264' + + + +# More complex examples + +# Download the best video no better than 720p prefering framerate greater than 30, +# or the worst video (still prefering framerate greater than 30) if there is no such video +$ youtube-dlc -f '((bv*[fps>30]/bv*)[height<=720]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=720]/(w[fps>30]/w)' + +# Download the video with the largest resolution no better than 720p, +# or the video with the smallest resolution available if there is no such video, +# prefering larger framerate for formats with the same resolution +$ youtube-dlc -S 'res:720,fps' + + + +# Download the video with smallest resolution no worse than 480p, +# or the video with the largest resolution available if there is no such video, +# prefering better codec and then larger total bitrate for the same resolution +$ youtube-dlc -S '+res:480,codec,br' ``` + + + + + +# MORE +For FAQ, Developer Instructions etc., see the [original README](https://github.com/ytdl-org/youtube-dl)