Advertisement
Guest User

ffmpeg: concat any videos

a guest
Feb 21st, 2014
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.89 KB | None | 0 0
  1. path=%ffmpeg_dir%;%path%
  2.  
  3. set input_dir=C:\Users\NoName\Desktop\input
  4.  
  5. rem 輸入路徑下只能含有要處裡的影片檔,依檔名排序 如 input_1 input_2 input_3 ...
  6.  
  7. set temp_dir=C:\Users\NoName\Desktop\temp
  8.  
  9. rem 請事先建立一個資料夾做暫存用,裡面必須是空的
  10.  
  11. set "videofilters=-vf "scale='w=min(720,trunc((480*33/40*dar+0.5)/2)*2):h=min(480,trunc((720*40/33/dar+0.5)/2)*2)',pad='w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2',setsar='sar=40/33'""
  12.  
  13. rem 統一解析度
  14.  
  15. if exist mylist.txt del mylist.txt
  16.  
  17. for /r "%input_dir%" %%i in (*.* ) do (
  18.  
  19. ffmpeg -i "%%~i" %videofilters% -c:v libx264 -async 1 -ac 2 -c:a libfdk_aac -f matroska "%temp_dir%\%%~ni.mkv"
  20.  
  21. rem 統一 codec
  22.  
  23. echo file '%temp_dir%\%%~ni.mkv'>>mylist.txt
  24.  
  25. rem 將暫存檔寫入List 檔案
  26.  
  27. )
  28.  
  29. ffmpeg -f concat -i mylist.txt -c copy output.mp4
  30.  
  31. rem 以複製 streaming 方式做檔案連接
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement