Skip to content

Instantly share code, notes, and snippets.

@dmertl
Last active May 18, 2024 18:22
Show Gist options
  • Save dmertl/c4623c5567b40db0d8d8e696f221a820 to your computer and use it in GitHub Desktop.
Save dmertl/c4623c5567b40db0d8d8e696f221a820 to your computer and use it in GitHub Desktop.
Windows FFmpeg Droppable Batch Files
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -t 00:00:15 "%~n1_clip%~x1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -t 00:01:00 "%~n1_clip%~x1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -t 00:00:30 "%~n1_clip%~x1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -vf "scale='if(lte(iw,ih),512,-1)':'if(lte(ih,iw),512,-1)',crop=512:512" "%~n1_512.mp4"
SHIFT
GOTO again
:done
SET listfile=_temp_concat_list.txt
SET outfile=%~n1_concat%~x1
:again
if "%~1" == "" GOTO done
echo file '%~1' >> %listfile%
SHIFT
GOTO again
:done
ffmpeg -f concat -safe 0 -i %listfile% -c copy %outfile%
DEL %listfile%
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -c copy -an "%~n1_noaudio%~x1"
DEL "%~1"
MOVE "%~dp1%~n1_noaudio%~x1" "%~1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -vf "scale=640:-1" "%~n1_640w%~x1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -filter_complex "[0]reverse[r];[0][r]concat=n=2:v=1:a=0" "%~n1_loop_rev%~x1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -vf reverse "%~n1_rev%~x1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -n -codec:a libmp3lame -q:a 1 "%~n1.mp3"
DEL "%~1"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -c:v libx264 "%~n1.mp4"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -c:v libx264 -crf 18 "%~n1_hq.mp4"
SHIFT
GOTO again
:done
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" "%~n1_%%d.png"
SHIFT
GOTO again
:done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment