Skip to content

Instantly share code, notes, and snippets.

@seaque
Last active March 1, 2024 08:16
Show Gist options
  • Save seaque/b3f8dbfdb7830589113e4d7f0f6f0392 to your computer and use it in GitHub Desktop.
Save seaque/b3f8dbfdb7830589113e4d7f0f6f0392 to your computer and use it in GitHub Desktop.
FFmpeg batch file for trimming videos with downmix 5.1 to stereo and subtitles from source video.
@echo off
:again
set /P start="Start: "
set /P end="End: "
set /P bit="Bitrate: "
set /P max="Maxrate: "
ffmpeg ^
-ss %start% ^
-to %end% ^
-i "%~1" ^
-c:v libx264 ^
-b:v %bit% ^
-maxrate %max% ^
-threads 10 ^
-c:a dca ^
-strict -2 ^
-af "volume=1.7, pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3" ^
"%~p1%~n1_1.mp4"
"%~p1%~n1.srt"
if NOT ["%errorlevel%"]==["0"] goto:error
echo %~n1 Done!
shift
if "%~1" == "" goto:end
goto:again
:error

echo There was an error.
pause
exit 0
:end

cls
echo Encoding succesful. This window will close after 7 seconds.
timeout /t 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment