0

I am trying to make an audio downloader with youtube-dl and ffmpeg which will:

  1. Download the best format of audio available on YouTube
  2. Embed thumbnail in the file.
  3. Convert the file to mp3.
  4. Delete everything from the folder except the converted mp3 file.

Below is the code I've come up with:

@echo off
cls
set /p playlist="Enter YouTube Link: " 
youtube-dl -f bestaudio[ext=m4a] -i --write-thumbnail --embed-thumbnail -o "%%(title)s.%%(ext)s" %playlist% --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && del {}"

The issues I've been facing with my code:

  1. The converted file is not renamed correctly. It's named Filename.m4a.mp3 where I want it to be named Filename.mp3
  2. Video thumbnail is saved as Filename.jpg and youtube-dl creates a file named cookies.txt. Those are not deleted automatically.
  3. Lastly, this error shows up: https://i.stack.imgur.com/wHYyw.png

[swscaler @ 00000143e0a4ffc0] deprecated pixel format used, make sure you did set range correctly [mp3 @ 00000143e09f0340] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2

I'd really appreciate it if you helped me fix those issues. Thanks!

0

Here's the code which is currently doing everything I need it to do:

@echo off
cls
set /p playlist="Enter YouTube Link: " 
youtube-dl -f bestaudio[ext=m4a] --extract-audio --write-thumbnail --embed-thumbnail -o "%%(title)s.%%(ext)s" %playlist% --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && del {}"
@For /R %%f in (*) Do (if not "%%~xf"==".mp3" Del "%%~f")
@For %%G In (*.m4a.mp3) Do @For %%H In ("%%~nG") Do @Ren "%%G" "%%~nH%%~xG"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.