I have 2 scripts that I use to cut 20 seconds at start and 20 seconds at the end of every video in a folder, using ffmpeg. For cutting the start of video I use: Code: for %%a in ("*.mp4") do "ffmpeg" -i %%a -ss 00:00:20.000 -c:v copy -c:a copy Trimmed\%%a And to cut the end I use 2 bat files: Trim1.bat Code: @echo off for %%i in (*.mp4) do ( call trim2.bat "%%i" ) Trim2.bat Code: @echo off for /f "tokens=*" %%a in ('ffprobe -show_format -i %1 ^| find "duration"') do set _duration=%%a set _duration=%_duration:~9% for /f "delims=. tokens=1*" %%b in ('echo %_duration%') do set /a "_durS=%%b" for /f "delims=. tokens=2*" %%c in ('echo %_duration%') do set "_durMS=%%c" rem following line is seconds to cut set /a "_durS-=20" set "_newduration=%_durS%.%_durMS%" set "_output=%~n1" md _fixed ffmpeg -ss 0 -i %1 -t %_newduration% -c copy "Trimmed%_output%.mp4" But this creates more files since it puts the trimmed files into a new folder, then trims those files into another new folder. So how do I merge these scripts so it cuts both start and end at the same time?