

youtube-dl gets filename from video and saves to var %%f.The -get-filename part requires an symbol before the youtube-dl path. One of the problems was that youtube-dl wasn't working properly if located in C:\Program Files\, but works when located somewhere that doesn't require Administrator Privileges.

I was able to create a script that works.

It says the file has already been downloaded, even when there is no file in the directory. Inline for /f "delims=" %%a in ('youtube-dl -f best "" -o -merge-output-format mp4') do (ffmpeg -y -i "C:\Users\Matt\Downloads\%%a.mp4" -c:v libvpx -b:v 1300K -crf 16 -pix_fmt yuv420p -map 0:v:0? -sn -c:a libvorbis -q:a 6 -ac 2 -map 0:a:0? -f webm "C:\Users\Matt\Downloads\%%a.webm")īefore the script can ever reach FFmpeg, youtube-dl fails to download the file. for /f "delims=" %%a in ('youtube-dl -f best "" -o -merge-output-format mp4') do (echo example)ĭownload Video, Save Title, Convert with FFmpeg This is used to save the title to a variable %%a. Download Video youtube-dl -f best "" -o "C:\Users\Matt\Downloads\%%(title)s.mp4" -merge-output-format mp4 I want to keep the original title, so it needs to read the title with youtube-dl, save it to a variable, and use that variable for FFmpeg input/output filename.ġ.
