Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal EnableDelayedExpansion
- rem ============Anime info==============
- set title=Nurarihyon no Mago
- set group=Salender-Raws
- set encode_info=[BD 1920x1080 x264 FLAC]
- set release_dir=..\[%group%] %title% (Vol 3) %encode_info%
- set bmdv_path=..
- set audiotrack=2
- rem ====================================
- rem ============Utils Paths=============
- set dgavcindex=d:\Programs\__Encoding\megui\tools\dgavcindex\DGAVCIndex.exe
- set eac3to=d:\Programs\__Encoding\eac3to\eac3to.exe
- set x264=d:\Programs\__Encoding\x264\x264_10_x64_2057.exe
- set avs2yuv=d:\Programs\__Encoding\avs2yuv\avs2yuv.exe
- set mkvmerge=d:\Programs\__Encoding\megui\tools\mkvmerge\mkvmerge.exe
- rem ====================================
- rem ============x264 params=============
- 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
- rem ====================================
- md "%release_dir%"
- for %%x in ("*.avs") do (
- echo "--------------------------------------------"
- echo "processing %%~nx"
- for /f "tokens=1,2,3" %%h in ("%%~nx") do (
- rem %%h - internal anime title (codename), short and clear
- rem %%i - episode number
- rem %%j - .m2ts filename (without extension)
- echo "----- extracting audio from the %%j.m2ts -----"
- %eac3to% %bmdv_path%\BDMV\STREAM\%%j.m2ts %audiotrack%:%%h_%%i.flac
- echo "----- [%%h_%%i] indexing video from the %%j.m2ts: -----"
- start /wait "Episode %%i indexing:" %dgavcindex% -i %bmdv_path%\BDMV\STREAM\%%j.m2ts -f 0 -o %%h_%%i.dga -e
- echo "----- [%%h_%%i] creating lossless -----"
- %avs2yuv% "%%x" -o %%h_%%i.y4m
- echo "----- [%%h_%%i] x264 1st pass -----"
- %x264% --pass 1 --crf 16.6 --slow-firstpass %x264params% --stats "%%h_%%i.stats" --output NUL 2>"x264_%%h_%%i.log" %%h_%%i.y4m
- echo "----- [%%h_%%i] x264 2nd pass -----"
- for /F "tokens=7 delims=. " %%k in ('findstr encoded x264_%%h_%%i.log') do (
- echo "----- [%%h_%%i] bitrate: %%k"
- %x264% --pass 2 --bitrate %%k %x264params% --stats "%%h_%%i.stats" --output %%h_%%i.mkv %%h_%%i.y4m
- )
- echo "----- [%%h_%%i] building final .mkv"
- %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"
- del %%h_%%i.y4m
- )
- )
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement