Advertisement
Guest User

Untitled

a guest
Oct 5th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3.  
  4. rem ============Anime info==============
  5. set title=Nurarihyon no Mago
  6. set group=Salender-Raws
  7. set encode_info=[BD 1920x1080 x264 FLAC]
  8. set release_dir=..\[%group%] %title% (Vol 3) %encode_info%
  9. set bmdv_path=..
  10. set audiotrack=2
  11. rem ====================================
  12.  
  13. rem ============Utils Paths=============
  14. set dgavcindex=d:\Programs\__Encoding\megui\tools\dgavcindex\DGAVCIndex.exe
  15. set eac3to=d:\Programs\__Encoding\eac3to\eac3to.exe
  16. set x264=d:\Programs\__Encoding\x264\x264_10_x64_2057.exe
  17. set avs2yuv=d:\Programs\__Encoding\avs2yuv\avs2yuv.exe
  18. set mkvmerge=d:\Programs\__Encoding\megui\tools\mkvmerge\mkvmerge.exe
  19. rem ====================================
  20.  
  21. rem ============x264 params=============
  22. set x264params=--level 4.1 --threads 12 --thread-input --deblock -2:-2 --bframes 8 --b-pyramid normal --ref 4 --qpmin 8 --qpmax 38 --no-mbtree --merange 24 --me umh --subme 9 --partitions all --psy-rd 0.80:0 --no-dct-decimate --trellis 2 --b-adapt 2 --qcomp 0.8 --direct auto --sar 1:1
  23. rem ====================================
  24.  
  25. md "%release_dir%"
  26.  
  27. for %%x in ("*.avs") do (
  28.     echo "--------------------------------------------"
  29.     echo "processing %%~nx"
  30.     for /f "tokens=1,2,3" %%h in ("%%~nx") do (
  31.         rem %%h - internal anime title (codename), short and clear
  32.         rem %%i - episode number
  33.         rem %%j - .m2ts filename (without extension)
  34.         echo "----- extracting audio from the %%j.m2ts -----"
  35.         %eac3to% %bmdv_path%\BDMV\STREAM\%%j.m2ts %audiotrack%:%%h_%%i.flac
  36.        
  37.         echo "----- [%%h_%%i] indexing video from the %%j.m2ts: -----"
  38.         start /wait "Episode %%i indexing:" %dgavcindex% -i %bmdv_path%\BDMV\STREAM\%%j.m2ts -f 0 -o %%h_%%i.dga -e
  39.        
  40.         echo "----- [%%h_%%i] creating lossless -----"
  41.         %avs2yuv% "%%x" -o %%h_%%i.y4m
  42.  
  43.         echo "----- [%%h_%%i] x264 1st pass -----"
  44.         %x264% --pass 1 --crf 16.6 --slow-firstpass %x264params% --stats "%%h_%%i.stats" --output NUL 2>"x264_%%h_%%i.log" %%h_%%i.y4m
  45.        
  46.         echo "----- [%%h_%%i] x264 2nd pass -----"
  47.         for /F "tokens=7 delims=. " %%k in ('findstr encoded x264_%%h_%%i.log') do (
  48.             echo "----- [%%h_%%i] bitrate: %%k"
  49.             %x264% --pass 2 --bitrate %%k %x264params% --stats "%%h_%%i.stats" --output %%h_%%i.mkv %%h_%%i.y4m
  50.         )
  51.        
  52.         echo "----- [%%h_%%i] building final .mkv"
  53.         %mkvmerge% -o "%release_dir%\[%group%] %title% %%i %encode_info%.mkv"  "--track-name" "1:[%group%] %title% %%i" "--default-track" "1:no" "--forced-track" "1:no" "--display-dimensions" "1:1920x1080" "--compression" "1:none" "-d" "1" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "%%h_%%i.mkv" "--language" "0:jpn" "--track-name" "0:LPCM -> FLAC" "--forced-track" "0:no" "--compression" "0:none" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "%%h_%%i.flac" "--track-order" "0:1,1:0"
  54.        
  55.         del %%h_%%i.y4m
  56.     )
  57. )
  58.  
  59. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement