Skip to content

Instantly share code, notes, and snippets.

@m-wild
Created May 18, 2014 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-wild/b487a7236d04cca2d4ca to your computer and use it in GitHub Desktop.
Save m-wild/b487a7236d04cca2d4ca to your computer and use it in GitHub Desktop.
ffmpeg video to webm converter with prompts (needs ffmpeg in PATH)
@echo off
echo ^>--- FFmpeg webm ---
echo.
set /P ffinput=">Input file: "
set /P ffbitrate=">Bitrate (e.g. 500k): "
set /P ffss=">Start time (hh:mm:ss): "
set /P ffduration=">Duration (ss): "
set /P fffps=">FPS: "
echo.
echo ^>ffmpeg -i %ffinput% -c:v libvpx -b:v %ffbitrate% -ss %ffss% -t %ffduration% -quality good -cpu-used 0 -r %fffps% -auto-alt-ref 1 -lag-in-frames 16 -vf scale=-1:720 -an -pass 1 -f webm null
echo.
echo ^>ffmpeg -i %ffinput% -c:v libvpx -b:v %ffbitrate% -ss %ffss% -t %ffduration% -quality good -cpu-used 0 -r %fffps% -auto-alt-ref 1 -lag-in-frames 16 -vf scale=-1:720 -an -pass 2 -f webm %ffinput%.webm
echo.
set /P ans=">Continue (y/n)? "
if /i {%ans%}=={y} (goto :run)
if /i {%ans%}=={yes} (goto :run)
goto :exit
:run
ffmpeg -i %ffinput% -c:v libvpx -b:v %ffbitrate% -ss %ffss% -t %ffduration% -quality good -cpu-used 0 -r %fffps% -auto-alt-ref 1 -lag-in-frames 16 -vf scale=-1:720 -an -pass 1 -f webm null
ffmpeg -i %ffinput% -c:v libvpx -b:v %ffbitrate% -ss %ffss% -t %ffduration% -quality good -cpu-used 0 -r %fffps% -auto-alt-ref 1 -lag-in-frames 16 -vf scale=-1:720 -an -pass 2 -f webm %ffinput%.webm
del null
del ffmpeg2pass*.log
echo ^>Done.
goto :exit
:exit
echo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment