Advertisement
mkv

vidcmp.bat

mkv
Jan 16th, 2020
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.59 KB | None | 0 0
  1. @echo off
  2.  
  3. rem assumes 1920x1080 input
  4. rem                            viewport:offset
  5. rem default crop for 4 files is 480:270:720:405
  6. rem     (1920-480)/2 = 720 = 25% horizontally centered
  7. rem     (1080-270)/2 = 405 = 25% vertically centered
  8. rem
  9. rem default crop for 2 files is 480:540:720:270
  10. rem   (1920-480)/2 = 720 = 25% horizontally centered
  11. rem   (1080-540)/2 = 270 = 50% vertically centered
  12.  
  13.  
  14. rem enable use of variables defined inside if-blocks using !var! instead of %var%
  15. setlocal EnableDelayedExpansion
  16.  
  17. if not "%~5"=="" (
  18.     goto :inval
  19.  
  20. ) else if not "%~4"=="" (
  21.    rem setpts=PTS-STARTPTS
  22.     set "crop=:v] setpts=N/(30*TB), crop=480:270:720:405, drawtext=fontsize=12:fontfile=Consolas:x=8:y=8:fontcolor=white:box=1:boxcolor=black@0.1:text="
  23.     ffmpeg -report -i "%~f1" -i "%~f2" -i "%~f3" -i "%~f4" -filter_complex "[0!crop!'%~n1' [v0]; [1!crop!'%~n2' [v1]; [2!crop!'%~n3' [v2]; [3!crop!'%~n4' [v3]; [v0][v1] hstack=inputs=2 [v01]; [v2][v3] hstack=inputs=2 [v23]; [v01][v23] vstack=inputs=2" -vcodec rawvideo -max_muxing_queue_size 99999 -f nut - | mpv -fs -pause -
  24.  
  25. ) else if not "%~3"=="" (
  26.     goto :inval
  27.  
  28. ) else if not "%~2"=="" (
  29.     set "crop=:v] setpts=N/(30*TB), crop=480:540:720:270, drawtext=fontsize=12:fontfile=Consolas:x=8:y=8:fontcolor=white:box=1:boxcolor=black@0.1:text="
  30.     ffmpeg -i "%~f1" -i "%~f2" -filter_complex "[0!crop!'%~n1' [v0]; [1!crop!'%~n2' [v1]; [v0][v1] hstack=inputs=2" -vcodec rawvideo -max_muxing_queue_size 99999 -f nut - | mpv -fs -pause -
  31.  
  32. ) else (
  33.     goto :inval
  34. )
  35.  
  36. rem pause
  37. exit
  38.  
  39. :inval
  40. echo drop 2 or 4 files on this bat
  41. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement