Skip to content

Instantly share code, notes, and snippets.

@lilithebowman
Last active October 9, 2018 18:48
Show Gist options
  • Save lilithebowman/ec0dd7867fb110d441f85a93cfa6d390 to your computer and use it in GitHub Desktop.
Save lilithebowman/ec0dd7867fb110d441f85a93cfa6d390 to your computer and use it in GitHub Desktop.
@ECHO OFF
echo You must download ffmpeg to use this batch file.
echo https://ffmpeg.zeranoe.com/builds/
echo .
echo A command prompt will pop up and churn for a while depending on the size
echo .
echo Add the list of files to concatenate to mylist.txt with "file " in front of the name. One per line.
echo Example:
echo file GOPR2307.MP4
echo file GP012307.MP4
echo file GP022307.MP4
echo .
echo This batch file will automatically concatenate, speed up the video 4x, and run extensive stabilization on the video.
echo .
echo Temporary files are in D:\tmp
pause
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
echo Start time: %time%
ls %tmp%\*.mp4
echo #############################
echo ##### RUN CONCATENATION #####
echo #############################
mkdir D:\tmp
ffmpeg -f concat -safe 0 -i mylist.txt -c copy %tmp%\concatenated.mp4
echo #########################################################
echo ##### RUN STABILIZATION DETECTION (Create TRF file) #####
echo #########################################################
ffmpeg -i %tmp%\concatenated.mp4 -vf vidstabdetect=stepsize=6:shakiness=5:accuracy=15:result=concatenated.trf -f null -
echo ######################################
echo ##### RUN STABILIZATION ON VIDEO #####
echo ######################################
ffmpeg -i %tmp%\concatenated.mp4 -vf vidstabtransform=input=concatenated.trf:zoom=1:smoothing=30,unsharp=5:5:0.8:3:3:0.4 -vcodec libx264 -preset slow -tune film -crf 18 -acodec copy stabilized_1x_speed.mp4
echo Press Ctrl+C or close this window to skip file cleanup.
echo If you press any other key, the temporary files will be deleted.
pause
del %tmp%\concatenated.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment