Search This Blog

Saturday, June 27, 2015

批次檔-ffmpeg轉檔及合併

 %1 -> command後的第一個參數
Ex: convert.bat test-bat
%1 -> test-bat
-----------------------
@ECHO OFF

echo ffmpeg -i %1-1 -target ntsc-dvd %1-1.avi
ffmpeg -i %1"-1" -target ntsc-dvd %1"-1.avi"

echo ffmpeg -i %1-2 -target ntsc-dvd %1-2.avi
ffmpeg -i %1"-2" -target ntsc-dvd %1"-2.avi"

echo ffmpeg -i %1-3 -target ntsc-dvd %1-3.avi
ffmpeg -i %1"-3" -target ntsc-dvd %1"-3.avi"

echo ffmpeg -i %1-4 -target ntsc-dvd %1-4.avi
ffmpeg -i %1"-4" -target ntsc-dvd %1"-4.avi"

'concat=>合併video
ffmpeg -i "concat:%1-1.avi|%1-2.avi|%1-3.avi|%1-4.avi" -c copy %1.avi

----------------------------------------------------------------------------------
批次將所有檔案轉為xvid格式,並把副檔名改為.avi ex: abc.wmv -> abc.avi

for %%x in (*.*) do ffmpeg -i %%x -c:v libxvid -b:v 2000k %%~nx.avi
--------------------------------------------------------------------------------