Skip to content

Instantly share code, notes, and snippets.

@madaboutcode
Created August 31, 2014 06:03
Show Gist options
  • Save madaboutcode/c91c8c189f2a66e68b0d to your computer and use it in GitHub Desktop.
Save madaboutcode/c91c8c189f2a66e68b0d to your computer and use it in GitHub Desktop.
ffmpeg batch encode
@echo off
if %1.==Sub. goto %2
echo Encoding files in %1
set dir=%1
if exist %dir%\encoded\NUL goto processfiles
mkdir %dir%\encoded
:processfiles
for %%f in (%dir%\*.MTS) do call %0 Sub encode %%f
goto end
:encode
set output=%~dp3encoded\%~n3.mp4
if exist %output% goto skip
echo Encoding %~nx3
ffmpeg -i "%3" -c:v libx264 -preset slow -crf 23 -maxrate 6000k -bufsize 500K -c:a libvo_aacenc -b:a 128k "%output%"
goto end
:skip
echo Skipping %~nx3
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment