如何使用download-dl仅通过mp4 .mkv或mp4格式的URL播放列表下载视频.webm?
我使用以下命令下载视频: youtube-dl -itcv --yes-playlist https://www.youtube.com/playlist?list=....
此命令的结果是带有扩展名的视频.mp4,.mkv或者.webm
如何使用download-dl仅通过mp4 .mkv或mp4格式的URL播放列表下载视频.webm?
我使用以下命令下载视频: youtube-dl -itcv --yes-playlist https://www.youtube.com/playlist?list=....
此命令的结果是带有扩展名的视频.mp4,.mkv或者.webm
Answers:
要列出可用的格式,请输入:
youtube-dl -F url
然后选择最好的一个
范例: youtube-dl -f 11 url 
来自webupd8的示例
youtube-dl -F http://www.youtube.com/watch?v=3JZ_D3ELwOQ
样本输出:
[youtube] Setting language
[youtube] 3JZ_D3ELwOQ: Downloading webpage
[youtube] 3JZ_D3ELwOQ: Downloading video info webpage
[youtube] 3JZ_D3ELwOQ: Extracting video information
[info] Available formats for 3JZ_D3ELwOQ:
format code extension resolution  note 
171         webm      audio only  DASH webm audio , audio@ 48k (worst)
140         m4a       audio only  DASH audio , audio@128k
160         mp4       192p        DASH video 
133         mp4       240p        DASH video 
134         mp4       360p        DASH video 
135         mp4       480p        DASH video 
136         mp4       720p        DASH video 
137         mp4       1080p       DASH video 
17          3gp       176x144     
36          3gp       320x240     
5           flv       400x240     
43          webm      640x360     
18          mp4       640x360     
22          mp4       1280x720    (best)
您可以选择best并输入
youtube-dl -f 22 http://www.youtube.com/watch?v=3JZ_D3ELwOQ
为了获得最佳视频质量(1080p DASH-格式“ 137”)和最佳音频质量(DASH音频-格式“ 140”),您必须使用以下命令:
youtube-dl -f 137+140 http://www.youtube.com/watch?v=3JZ_D3ELwOQ
编辑
您可以在此处获得更多选择
视频选择:
--playlist-start NUMBER          Playlist video to start at (default is 1)
--playlist-end NUMBER            Playlist video to end at (default is last)
--playlist-items ITEM_SPEC       Playlist video items to download. Specify
                             indices of the videos in the playlist
                             separated by commas like: "--playlist-items
                             1,2,5,8" if you want to download videos
                             indexed 1, 2, 5, 8 in the playlist. You can
                             specify range: "--playlist-items
                             1-3,7,10-13", it will download the videos
                             at index 1, 2, 3, 7, 10, 11, 12 and 13.
--match-title REGEX              Download only matching titles (regex or
                             caseless sub-string)
--reject-title REGEX             Skip download for matching titles (regex or
                             caseless sub-string)
--max-downloads NUMBER           Abort after downloading NUMBER files
--min-filesize SIZE              Do not download any videos smaller than
                             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
--datebefore DATE                Download only videos uploaded on or before
                             this date (i.e. inclusive)
--dateafter DATE                 Download only videos uploaded on or after
                             this date (i.e. inclusive)
--min-views COUNT                Do not download any videos with less than
                             COUNT views
--max-views COUNT                Do not download any videos with more than
                             COUNT views
--match-filter FILTER            Generic video filter (experimental).
                             Specify any key (see help for -o for a list
                             of available keys) to match if the key is
                             present, !key to check if the key is not
                             present,key > NUMBER (like "comment_count >
                             12", also works with >=, <, <=, !=, =) to
                             compare against a number, and & to require
                             multiple matches. Values which are not
                             known are excluded unless you put a
                             question mark (?) after the operator.For
                             example, to only match videos that have
                             been liked more than 100 times and disliked
                             less than 50 times (or the dislike
                             functionality is not available at the given
                             service), but who also have a description,
                             use --match-filter "like_count > 100 &
                             dislike_count <? 50 & description" .
--no-playlist                    Download only the video, if the URL refers
                             to a video and a playlist.
--yes-playlist                   Download the playlist, if the URL refers to
                             a video and a playlist.
--age-limit YEARS                Download only videos suitable for the given
                             age
--download-archive FILE          Download only videos not listed in the
                             archive file. Record the IDs of all
                             downloaded videos in it.
--include-ads                    Download advertisements as well
                             (experimental)
youtube-dl --yes-playlist url
                    像这样(来源):
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' url-f bestvideo+bestaudio/best,因此已经可以下载bestvideo和bestaudio(并自动将它们混合在一起成为结果文件) 。资料来源:github.com/rg3/youtube-dl/blob/master/…–
                    --audio-format选项)时会进行转码,但是您就在这里:事实并非如此,因为您要强制youtube-dl下载两个文件(bestaudio [ext = mp4]和bestvideo [ext = m4a])具有相同的通用容器(mp4),因此无论内容如何,在对其进行重新混合时,它们都将堆叠在另一个mp4中,而无需任何转码。
                    根据glenn-slayden的评论,获得的视频质量最高的mp4格式如下:
我知道这个线程有点旧,但是我认为情况有所改变。对于我的目标:
- 首先,无论格式如何,始终获得最佳的视频质量;
- 但是,永远不要让音频格式独自导致您丢失mp4。
以前,我使用
bestvideo+bestaudio/best,但是我发现以下变体在减少mkv,(显然)消除效果更好webm,但仍然可以保证最高质量的视频(使用此--merge-output-format选项时请勿使用该选项):--format bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best注意,在第一个术语中,
ext过滤器是为音频而不是视频指定的,在上面的讨论中我没有看到该技术。如果对于我说的目标来说倒是这样,那可能是因为考虑到我们正在尝试确保视频格式为mp4,为什么对音频设置了约束?关键是,如果每个后备条件(用斜杠分隔)的要求的任何部分均失败,则它们将失败,然后继续下一个条件。使用时
bestvideo+bestaudio,很多情况下都会出现非mp4容器的情况,因为这种格式选择明确地坚持bestaudio,这可能意味着混合格式。这是因为bestvideo+bestaudio命令过于坚持以至于您被迫退出mp4。但是,如果您更关心获得mp4容器而不是音频质量,该怎么办?通过坚持
m4a音频第一-但后来松口上,而刚刚发布的那部分bestvideo再- (通过使用上述格式选择),你基本上是表达一种灵活的偏好为mp4在其他容器; 你一定不希望mp4如果可能的话,但不能以降低视频质量的成本。正如我所说,您可能仍然会得到一些
mkv,但是它们的数量将大大减少,并且仅在需要提供(据说)更好的视频时才使用。到目前为止,对于这种配置,我什么都没有看到webm,因为类似248 + 140的结果最终显示为mkv。
在后一种情况下,--merge-output-format mp4如果需要,添加将转换为mp4。因此完整的命令是:
youtube-dl --format "bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best" --merge-output-format mp4
--list-formats和--format nn开关。