我需要把數位相機裡面的 mov 檔轉成大家都能在一般放影機可觀賞的 mpeg2. 於是我寫了一個 dos 的批次檔, 滑鼠雙擊, 自動轉檔.
目標:
把某個目錄裡所有的 mov 檔全部抓出來, 一個一個轉成我要的格式.
使用方式:
Step 1: 下載 vlc: http://wiki.videolan.org/Main_Page
Step 2: 打開 批次檔內容, 指定目錄 (程式會自動搜尋所有相關的子目錄)
Step 3: 滑鼠 double-clicked
Step 4: Enjoy.
詳細作法如下:
------------------- 03_transcode_demo_batch.bat --------------
:: Conver all mov files located in the assigned sourcedir to the mpeg2 files.
:: by Jing
:: command string echo: off
echo off
set sourcedir="G:\YOUR_MOV_DIR\"
::set vb=4096
set vb=800
:: foo loop walk through all mov files
:: Note :
:: 1. %%F : that is wrong if you use
:: "double-character" ex: %%FF
:: 2. %%F : represents the fullfilename
for /R %sourcedir% %%F in (*.mov) do (
:: echo "%%F"
call :sub_vlc "%%F"
)
goto :end
:: SUB transcode mov to mpeg2
:: Note:
:: 1. %~1: remove any surrounding quotes (").
:: ref: http://www.computerhope.com/forhlp.htm
:sub_vlc
set source=%1
set target="%~1.mpg"
:: Note:
:: 1. -I dummy: don't use an interface
:: 2. vlc://quit: quit when finish
set command=-I dummy -vvv %source% :sout=#transcode{vcodec=mp2v,vb=%vb%,scale=1,acodec=mpga,ab=128,channels=2}:duplicate{dst=std{access=file,mux=ts,dst=%target%}} vlc://quit
@echo --------------------
@echo source=%source%
@echo target=%target%
@echo command=%command%
@echo --------------------
call "C:\Program Files\VideoLAN\VLC\vlc.exe" %command%
goto :end
:end
------------------- end of 03_transcode_demo_batch.bat -------------
Reference
[1] http://www.computerhope.com/forhlp.htm