gists/batch_encoding/enc.bat
2018-10-11 16:45:29 +02:00

41 lines
1.6 KiB
Batchfile
Executable File

@ECHO OFF
set input=%1
set output="%~p1%~n1.fdk.mp4"
REM any of these can be commented out
set trim=start=0:duration=41
set scale=640:480
set aspect=4:3
set volume=24dB
REM -b:v 1280k + -vbr 5 ~= 10MiB/s
set video_bitrate=-crf 23 -maxrate 2560k -bufsize 5120k
set x264=-profile:v high -preset slow
set fdk=-profile:a aac_he_v2 -vbr 5 -cutoff 18000
set general=-y -sn -dn -metadata = -map_chapters -1 -movflags +faststart
REM attack|right :release|right:inL/out|./...:knee:g:start:delay
set "limA=compand=0.0050|0.0050:0.0500|0.0500:-14/-14|0/-14:0.01:0:-14:0.0052"
set "limB=compand=0.0010|0.0010:0.0100|0.0100:-13/-13|0/-13:0.01:0:-13:0.0010"
set "limC=compand=0.0005|0.0005:0.0100|0.0100:-12/-12|0/-12:0.01:0:-12:0.0015"
set "limD=compand=0.0000|0.0000:0.0100|0.0100:-12/-12|0/-12"
set "louderizer=volume=0.25,aformat=channel_layouts=stereo,asetrate=705600,%limA%,%limB%,%limC%,asetrate=44100,%limD%,volume=3.98"
set sanity=lowpass=18000:4,highpass=40:4
set vf=
set af=
if NOT "%scale%"=="" set "vf=%vf%,scale=%scale%"
if NOT "%trim%"=="" set "vf=%vf%,trim=%trim%,setpts=PTS-STARTPTS"
if NOT "%trim%"=="" set "af=%af%,atrim=%trim%,asetpts=PTS-STARTPTS"
if NOT "%volume%"=="" set "af=%af%,asetrate=44100,volume=%volume%,%sanity%,%louderizer%"
if NOT "%vf%"=="" set vf=-vf "%vf:~1%"
if NOT "%af%"=="" set af=-af "%af:~1%"
if NOT "%aspect%"=="" set "aspect=-aspect %aspect%"
set video=%video_bitrate% -c:v libx264 %x264% -threads 0 %aspect% %vf%
set audio=-c:a libfdk_aac %fdk% -ar 44100 -ac 2 %af%
start /low /wait /b ffmpeg -i %input% %general% %video% %audio% %output%