title: ffmpeg conversion - keep audio bitrate
body: <p>I'm using ffmpeg to extract the audio from different video formats (flv, mp4) and convert it to mp3.</p>
  
  <pre><code>%~dp0ffmpeg.exe -i %1 -ar 44100 -ac 2 -ab 128k "%~dpn1.mp3"
  </code></pre>
  
  <p>This works just fine. However, in my input files, the audio bitrate varies, and I want to adjust the output bitrate accordingly. Even by extensive Google searching, I didn't find any hint how to just keep the original bitrate.</p>
  
  <p>What I would need would be something like:</p>
  
  <pre><code>-ab copy
  </code></pre>
  
  <p>Which, of course, does not work.</p>
  
  <p>Is there anything that will work?</p>
  
  <p>P.S: As you might have figured from the formatting above, I'm using a windows batch file. There would be the hack to use <em>%~dp0ffmpeg.exe -i</em>, get the audio bitrate by grep and insert it in the command line. I just think there <strong>has</strong> to be an easier and more elegant way.</p>