ffmpeg := "C:\Programs\ffmpeg\bin\ffmpeg.exe" Menu, Tray, Icon, C:\Programs\ffmpeg\ffmpeg.ico looppass := 0 Loop, %0% { cur_item := %A_Index% if InStr(FileExist(cur_item), "D") Loop, %cur_item%\*.* Processing(A_LoopFileFullPath) else Processing(cur_item) } return Processing(path) { global ffmpeg global looppass Loop %path%, 1 longpath = %A_LoopFileLongPath% SplitPath, longpath, filename, longdir, ext, name SplitPath, longdir,,,,dir targetdir := longdir . "\" . dir . "-encoded" ifnotexist, %targetdir% FileCreateDir, %targetdir% SetWorkingDir %targetdir% now = %A_Now% target := targetdir . "\" . filename . "." . now . ".webm" passlogfile := targetdir . "\" . filename . "." . now . ".passlogfile" fm_src := fm(longpath) ass := longdir . "\" . name . ".ass" fm_ass := fm(ass) params = -i "%longpath%" -c:v libvpx -b:v 180k -c:a libvorbis -qscale:a 0 -ac 2 -auto-alt-ref 1 -lag-in-frames 25 -quality good -threads 4 -passlogfile "%passlogfile%" looppass := looppass + 1 menu, tray, tip, VP8 - item %looppass%:`n%filename% (1st pass)`n%params% runwait %ffmpeg% %params% -pass 1 -an -f rawvideo -y NUL, , min menu, tray, tip, VP8 - item %looppass%:`n%filename% (2nd pass)`n%params% RunWait %ffmpeg% %params% -pass 2 -y -f webm "%target%", , min filedelete, %passlogfile%* return } fm(input_str) { StringReplace, output_str, input_str, \, \\, All StringReplace, output_str, output_str, `:, \`:, All return output_str }