Difference between revisions of "VLC HowTo/Transcode multiple videos"
Jump to navigation
Jump to search
Andrewboden (talk | contribs) |
m (vlc://quit ref) |
||
Line 14: | Line 14: | ||
=== Windows === | === Windows === | ||
− | for %%a in (*.VOB) do "C:\Program Files\VideoLAN\VLC\vlc" -I dummy -vvv %%a --sout=#transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=192,channels=2,deinterlace}:standard{access=file,mux=ts,dst=%%a.mpg} vlc:quit | + | for %%a in (*.VOB) do "C:\Program Files\VideoLAN\VLC\vlc" -I dummy -vvv %%a --sout=#transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=192,channels=2,deinterlace}:standard{access=file,mux=ts,dst=%%a.mpg} vlc://quit |
For example, to transcode a batch of m4a files (potentially in multiple subdirectories of a single common root directory) to mp3 files (512kb/s encoding with 44100 sampling frequency) you could use the following code in a Windows XP command prompt: | For example, to transcode a batch of m4a files (potentially in multiple subdirectories of a single common root directory) to mp3 files (512kb/s encoding with 44100 sampling frequency) you could use the following code in a Windows XP command prompt: | ||
Line 68: | Line 68: | ||
:eof | :eof | ||
+ | |||
+ | The same as above, for vlc >= 0.9: | ||
+ | @ECHO OFF | ||
+ | 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="mp3",ab="512","channels=2"}:standard{access="file",mux="raw",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 | ||
+ | |||
=== Unix / Linux === | === Unix / Linux === | ||
Line 81: | Line 108: | ||
for a in *$fmt; do | for a in *$fmt; do | ||
− | $vlc -I dummy -vvv "./$a" --sout "#transcode{vcodec=$vcodec,vb=$bitrate,acodec=$acodec,ab=$arate,channels=6}:standard{mux=$mux,dst=\"$dst$a.$ext\",access=file}" vlc:quit | + | $vlc -I dummy -vvv "./$a" --sout "#transcode{vcodec=$vcodec,vb=$bitrate,acodec=$acodec,ab=$arate,channels=6}:standard{mux=$mux,dst=\"$dst$a.$ext\",access=file}" vlc://quit |
done | done |
Revision as of 02:14, 28 September 2008
Idea
The idea is to use VLC to do some batch work to encode or transcode multiple files one after each other, without having to care about it.
You may want to transcode all your videotheque to another format to play them on an IPod, a Zune, a PS3 or a Xbox.
Codecs / Muxers
You have to choose the correct codecs for the device you want to transcode for.
We choose here H.264 with AAC in a MPEG-2/TS muxer as an example.
Command Lines
Windows
for %%a in (*.VOB) do "C:\Program Files\VideoLAN\VLC\vlc" -I dummy -vvv %%a --sout=#transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=192,channels=2,deinterlace}:standard{access=file,mux=ts,dst=%%a.mpg} vlc://quit
For example, to transcode a batch of m4a files (potentially in multiple subdirectories of a single common root directory) to mp3 files (512kb/s encoding with 44100 sampling frequency) you could use the following code in a Windows XP command prompt:
@ECHO OFF REM ######################################################################## REM # A Windows XP cmd.com script to batch convert m4a files to mp3. # REM # # REM # Copyright (C) 2008 Andrew Boden # REM # (boden@graduate.uwa.edu.au) # REM # # REM # This program is free software: you can redistribute it and/or modify # REM # it under the terms of the GNU General Public License as published by # REM # the Free Software Foundation, either version 3 of the License, or # REM # (at your option) any later version. # REM # # REM # This program is distributed in the hope that it will be useful, # REM # but WITHOUT ANY WARRANTY; without even the implied warranty of # REM # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # REM # GNU General Public License for more details. # REM # # REM # You should have received a copy of the GNU General Public License # REM # along with this program. If not, see <http://www.gnu.org/licenses/>.# REM # # REM # Version 1.0 (June 27th 2008) # REM # Uses VideoLAN VLC 0.8.6h (www.videolan.org) # REM # Gracefully handles commas and apostrophes in file names. # REM # Not aware of any other characters needing graceful handling. # REM # 512kbps encoding with 44100 sampling. # REM ######################################################################## 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
The same as above, for vlc >= 0.9:
@ECHO OFF 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="mp3",ab="512","channels=2"}:standard{access="file",mux="raw",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
Unix / Linux
vcodec="h264" acodec="mp4a" bitrate="1024" arate="192" ext="mpg" mux="ts" vlc="/usr/bin/vlc" fmt="VOB" dst="/home/user/" for a in *$fmt; do $vlc -I dummy -vvv "./$a" --sout "#transcode{vcodec=$vcodec,vb=$bitrate,acodec=$acodec,ab=$arate,channels=6}:standard{mux=$mux,dst=\"$dst$a.$ext\",access=file}" vlc://quit done