cobaltB12
cobaltB12

Reputation: 411

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

I used the exact same youtube-dl command without the playlist option to download individual audio files, and it worked. But when I use it for this playlist, I get an error: Cannot download a video and extract audio into the same file! Use "(ext)s.%(ext)s" instead of "(ext)s" as the output template

Running on windows 10. Any help would be greatly appreciated!!

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

Upvotes: 2

Views: 6007

Answers (1)

anon
anon

Reputation:

If you look at the output, you see that the percent signs in your output template were gobbled up:

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

That is because in a batch file, you need to write %% if you want a percent sign, and double that again for call, like this:

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

Upvotes: 2

Related Questions