title: Batch script to convert, youtube-dl webm file to mp3 with ffmpeg
body: <p>I'm using <a href="https://github.com/rg3/youtube-dl/blob/master/README.md#readme" rel="noreferrer">youtube-dl</a> to extract the best possible audio quality from youtube videos. However the best quality audio usually turns out to be the webm format, which isn't useful. I would like to write a batch script that converts the webm file to an mp3 with ffmpeg. I've already tried using <a href="https://www.reddit.com/r/learnprogramming/comments/44nhzp/how_to_use_youtubedl_and_ffmpeg_to_download/" rel="noreferrer">this guide</a> on reddit to do it, but it doesn't seem to work. It appears to create an empty mp3 file that displays an error when i try to play it and the meta data is also completly blank.</p>
  
  <p>Here is the batch script:</p>
  
  <pre><code>for %%a in ("Downloaded\*.*") do %CD%\ffmpeg\bin\ffmpeg.exe -i "%%a" -vn -ar 44100 -ac 2 -ab 192k -f mp3 "Converted\%%~na.mp3" pause
  </code></pre>
  
  <p>I'll also give an explanation of how the whole thing should work. </p>
  
  <p>The idea is, is that you use youtube-dl to extract the best possible audio, then put that file into the Downloaded folder (see pic below) and then you run the mp3 script (which uses commands from ffmpeg) to convert the webm file in the Downloaded folder to a mp3 file, and place it in the Converted folder. The mp3 script is the code above. But it doesn't seem to work properly. </p>
  
  <p>I'm not very familiar with batch scripting, nor with ffmpeg so any help would be appreicated.</p>
  
  <p>Here is the picture to complement the explanation part.</p>
  
  <p><a href="https://i.stack.imgur.com/so6Ro.png" rel="noreferrer"><img src="https://i.stack.imgur.com/so6Ro.png" alt="enter image description here"></a></p>