youtube-dl error:Cannot download a video and extract audio into the same file

youtube-dl error:Cannot download a video and extract audio into the same file

我使用不带播放列表选项的完全相同的 youtube-dl 命令来下载单个音频文件,并且成功了。但是当我将它用于此播放列表时,出现错误:无法下载视频并将音频提取到同一文件中!使用“(ext)s.%(ext)s”而不是“(ext)s”作为输出模板

运行 于 windows 10。如有任何帮助,我们将不胜感激!!

PS C:\xxx\FFMPEG> .\YouTubeBatchAudioPlaylistIndexes.bat


C:\xxx\FFMPEG>call bin\youtube-dl.exe -x --audio-format "mp3" --audio-quality 3 --batch-file="songs.txt" --playlist-items 4,6,7,8,10,11,16,17,20,21,23,25,27,28,31,33,36,38,39,41,43,45,46,48,50 -o"C:\Users\xxx\Downloads\%(title)s.%(ext)s" --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-x', '--audio-format', 'mp3', '--audio-quality', '3', '--batch-file=songs.txt', '--playlist-items', '4,6,7,8,10,11,16,17,20,21,23,25,27,28,31,33,36,38,39,41,43,45,46,48,50', '-oC:\Users\xxx\Downloads\(ext)s', '--verbose']
[debug] Batch file urls: ['https://www.youtube.com/watch?v=anurOHpo0aY&index=4&list=PLlRluznmnq9f7OMI4avwFyV2xMVxlV3_w&t=0s']
Usage: youtube-dl.exe [OPTIONS] URL [URL...]

youtube-dl.exe: error: Cannot download a video and extract audio into the same file! Use "C:\Users\xxx\Downloads\(ext)s.%(ext)s" instead of "C:\Users\xxx\Downloads\(ext)s" as the output template

如果您查看输出,您会发现输出模板中的百分号被吞噬了:

(...) '-oC:\Users\xxx\Downloads\(ext)s', '--verbose']

那是因为在批处理文件中,you need to write %% if you want a percent sign,然后将 再次 加倍以获得 call,如下所示:

call bin\youtube-dl.exe -x --audio-format "mp3" --audio-quality 3 ^
     --batch-file="songs.txt" --playlist-items ^
    4,6,7,8,10,11,16,17,20,21,23,25,27,28,31,33,36,38,39,41,43,45,46,48,50 ^
    -o "C:\Users\xxx\Downloads\%%%%(title)s.%%%%(ext)s" --verbose