convert.bat:

@echo off

rem ******** SETTING UP ********
call .\settings.bat

rem *** BIT DEPTH ***
if %bit_depth%==8 (
    set pfmt=-pix_fmt yuv420p -profile:v 0
) else (
    set pfmt=-pix_fmt yuv420p10le -profile:v 2
)

rem *** CROP ***
if %crop_top%==1 (
    set crop_top_data=0.09
) else (
    set crop_top_data=0
)
if %crop_uid%==1 (
    set crop_uid_data=0.976
) else (
    set crop_uid_data=1
)

set advparams=%advparams% -filter:v "crop=h=in_h*(%crop_uid_data%-%crop_top_data%):y=in_h*%crop_top_data%,scale=h=%out_height%*(%crop_uid_data%-%crop_top_data%):force_original_aspect_ratio=decrease,setsar=1"

set params=%refreshrate% %vqual% %pfmt% %advparams% %cut%

rem ******** FIRST PASS ********
if not exist ffmpeg2pass-0.log (
    ffmpeg -i input.mkv %params% -pass 1 -an -f null NUL
)

rem ******** SECOND PASS ********
ffmpeg -y -i input.mkv %params% %audioparams% -pass 2 %out%.webm


rem ******** CLEANUP ********
if exist ffmpeg2pass-0.log (
    del ffmpeg2pass-0.log
)

pause

settings.bat:

set crop_uid=0
set crop_top=0

set cut=-ss 00:00:13 -to 00:00:54.2
rem set cut=-ss 00:00:05 -to 00:00:23

set refreshrate=-r 30
rem set out_height=540
set out_height=720

set bit_depth=8
set audioparams=-b:a 64k

set vqual=-crf 30
rem set vqual=-b:v 1200k

set advparams=-c:v libvpx-vp9 -quality good -threads 16 -lag-in-frames 25 -g 240 -cpu-used 4 -auto-alt-ref 1 -arnr-maxframes 8 -aq-mode 0 -tile-rows 0 -tile-columns 1 -enable-tpl 1 -row-mt 1
set out=video
Edit Report
Pub: 01 May 2022 06:46 UTC
Views: 66