title: How to convert MP4 to MP3 in VLC using Command-Prompt?
body: <p>I have close to 0 programming experience but would like to figure out how to do this and have been trying to figure out how to do this for awhile.  I'm getting very frustrated - wish I could understand it.  I'm trying to convert a bunch of MP4 files to MP3 files.  I would like to keep the original file and just spit out a bunch of MP3 files with same name as the original file.</p>
  
  <p>From here: <a href="https://wiki.videolan.org/How_to_Batch_Encode/" rel="nofollow">https://wiki.videolan.org/How_to_Batch_Encode/</a></p>
  
  <p>Apparently, all you need to do is use this code in the Command-Prompt.  I have never really used the Command-Prompt before so no idea what to do.</p>
  
  <pre><code>FOR /R %%G IN (*.m4a) DO (CALL :SUB_VLC "%%G")
  FOR /R %%G IN (*.m4a.mp*) DO (CALL :SUB_RENAME "%%G")
  GOTO :eof
  
  :SUB_VLC
   SET _firstbit=%1
   SET _qt="
   CALL SET _newnm=%%_firstbit:%_qt%=%%
   SET _commanm=%_newnm:,=_COMMA_%
   REM echo %_commanm%
   CALL "C:\Program Files\VideoLAN\VLC\vlc" -I dummy -vvv %1 --sout=#transcode{acodec="mpga",ab="512","channels=2",samplerate="44100"}:standard{access="file",mux="mpeg1",dst="%_commanm%.mp3"} vlc://quit
  GOTO :eof
  
  :SUB_RENAME
   SET _origfnm=%1
   SET _endbit=%_origfnm:*.m4a=%
   CALL SET _newfilenm=%%_origfnm:.m4a%_endbit%=.mp3%%
   SET _newfilenm=%_newfilenm:_COMMA_=,%
   COPY %1 %_newfilenm%
   DEL %1
  GOTO :eof
  
  :eof
  </code></pre>
  
  <ol>
  <li>So far I changed the directory in the Command-Prompt to the
  folder where the MP4 files are located.</li>
  <li>In the code, I've changed all mention of .m4a to .mp4. </li>
  <li>I've change mpga to mp3. </li>
  <li>I've changed "C:\Program Files\VideoLAN\VLC\vlc" to where my vlc program
  is located.</li>
  </ol>
  
  <p><strong>What else do I need to do?  And what do all the %% mean in the code?</strong></p>
  
  <p>Thank you so much!</p>