Batch extraction of audio streams

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
JinF
New Cone
New Cone
Posts: 4
Joined: 15 May 2009 16:34

Batch extraction of audio streams

Postby JinF » 24 Sep 2011 10:15

Hello,

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
I've tried using --no-sout-video as well, but that didn't change anything. Any help is appreciated.

JinF
New Cone
New Cone
Posts: 4
Joined: 15 May 2009 16:34

Re: Batch extraction of audio streams

Postby JinF » 06 Oct 2011 00:45

Nobody can see what the problem could be?

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Batch extraction of audio streams

Postby mederi » 06 Oct 2011 20:50

There is something wrong with the code. You have just created an endless loop as it adds new mp4 files in the same folder. I would make subfolder "OUTPUT" and direct results there.
What is this part supposed to do?

Code: Select all

SET _firstbit=%1 SET _qt=" CALL SET _newnm=%%_firstbit:%_qt%=%% SET _commanm=%_newnm:,=_COMMA_%
It gives me just unquoted %1. In this case you could simply use %~1.
"GOTO eof" jumps to a label called "eof" as you have defined at the end of your code (:eof), but GOTO:EOF is internal command to leave a file immediately (jump to a very End Of File).
But first of all, is standalone VLC command correct?


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 37 guests