I have a bunch of MP4 files that I need to re-encode the audio of, so I decided to see if I could simply extract and encode it with VLC. It works when using the GUI with the options of RAW encapsulation, no video and AAC audio @128Kbit,2Channel,44100. All I do afterward is remux it and I am done. However I have over 300 files and doing this by hand would take forever, so I decided to see how to do batch work with VLC. I came up with the following script which I think uses the same settings as I see in the GUI, but the files it creates are broken. They are about 1MB smaller than the ones created with VLC by hand and will not play in any player. I know that VLC can do what I want because I made several extractions like this by hand, so it must be something in my script.
Code: Select all
@ECHO OFF
FOR /R %%G IN (*.mp4) DO (CALL :SUB_VLC "%%G")
GOTO :eof
:SUB_VLC
SET _firstbit=%1
SET _qt="
CALL SET _newnm=%%_firstbit:%_qt%=%%
SET _commanm=%_newnm:,=_COMMA_%
REM echo %_commanm%
CALL "G:\VideoLAN\VLC\vlc" -I dummy -vvv %1 --sout=#transcode{vcodec="none",acodec="mp4a",ab="128","channels=2",samplerate="44100"}:standard{access="file",mux="raw",dst="%_commanm%.mp4"} vlc://quit
PAUSE
GOTO :eof
:eof
PAUSE