2

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
cobaltB12
  • 361
  • 1
  • 3
  • 9
  • Seems you are downloading the files and extracting audio into the same file. Break it into two jobs. – Sesha Kiran Apr 14 '18 at 16:30
  • I don't want to download the video at all, only the audio. How do I change it so it doesn't download the video? – cobaltB12 Apr 14 '18 at 16:48
  • @SeshaKiran's comment is unrelated to the actual problem. I'll post an answer. –  Apr 14 '18 at 16:54

1 Answers1

2

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
  • I have been using %%, so I don't understand how the % was deleted, the following is what i used in my batch file 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 --output "%USERPROFILE%\Downloads\%%(title)s.%%(ext)s" --verbose – cobaltB12 Apr 15 '18 at 07:46
  • Sorry, I forgot that you're using `call`. `call` is doing its own interpretation too, so you need **four** percent signs. –  Apr 15 '18 at 08:03
  • thank you so much, that worked! I was using `start` in the other batch file – cobaltB12 Apr 15 '18 at 08:24