roblox-gif-maker/frame_extractor.bat

35 lines
938 B
Batchfile
Raw Permalink Normal View History

2024-08-17 08:17:41 +00:00
@echo off
if "%1"=="" (
echo Please provide the input file as the first argument.
goto :eof
)
if "%2"=="" (
echo Please provide the scale as the third argument.
goto :eof
)
set input_file=%1
set scale_width=%2
if "%scale_width%"=="0" (
set scale_width=-1
)
set video_string="scale=%scale_width%:-1"
if not "%3"=="" (
set video_string=%video_string%,colorkey=%3:0.1:0.1
)
set output_folder=dumped_frames
if exist %output_folder% (
rmdir %output_folder% /Q/S
)
mkdir %output_folder%
ffmpeg -i %input_file% -nostats -loglevel 0 -vf "%video_string%,split[a][b];[a]alphaextract[am];[b][am]alphamerge" "%output_folder%/frame_%%04d.png"
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "%output_folder%/frame_0001.png" > %output_folder%/frame_size.txt
set /p frame_size=<%output_folder%/frame_size.txt
echo Done, the images have been dumped to %output_folder% with frame size of %frame_size%.