Skip to content

Instantly share code, notes, and snippets.

@rytsikau
Last active July 15, 2020 17:45
Show Gist options
  • Save rytsikau/14863518863ac38ec5ba3f1f8fd92aa8 to your computer and use it in GitHub Desktop.
Save rytsikau/14863518863ac38ec5ba3f1f8fd92aa8 to your computer and use it in GitHub Desktop.
This Windows batch script can make timelapse video with FFmpeg executable library. Source video fullname needs as an argument
@echo off
set FOLDEROUTPUT=c:\output
set FOLDERFFMPEG=c:\programs\ffmpeg
set VIDEOPRESET_1=-preset ultrafast
set VIDEOPRESET_2=-vcodec h264_qsv -q 20
if [%1]==[] goto noargument
:begin
cls
echo Videofile: %1
set /p SPEEDFACTOR=Enter speed factor (for example 10, or 0.2):
echo.
echo Choose FFmpeg video encoding setting:
echo [1] %VIDEOPRESET_1%
echo [2] %VIDEOPRESET_2%
echo [3] Type other...
echo [4] Go back
echo [5] Exit
echo.
set /p "a=Enter choice number: "
if "%a%"=="1" goto preset_1
if "%a%"=="2" goto preset_2
if "%a%"=="3" goto preset_user
if "%a%"=="4" goto begin
if "%a%"=="5" goto end
:preset_1
set PRESET=%VIDEOPRESET_1%
goto main
:preset_2
set PRESET=%VIDEOPRESET_2%
goto main
:preset_user
set /p PRESET=Type your setting here:
goto main
:main
for %%a in (%1) do set "FILENAME=%%~na"
md %FOLDEROUTPUT%
%FOLDERFFMPEG%\ffmpeg.exe -loglevel panic -stats -i %1 -filter:v "setpts=PTS/%SPEEDFACTOR%" %PRESET% -r 60 -an "%FOLDEROUTPUT%\(speed x%SPEEDFACTOR%) %FILENAME%.mp4"
goto :end
:noargument
echo This script needs source video fullname as an argument!
echo.
pause
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment