Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- set "DIR_FFMPEG=C:\Misc\Programs\FFmpeg"
- ::==============================================================================================
- :start
- cls
- echo Drag ^& drop the file to convert below.
- echo.
- set /p "INPUT_FILE=File: "
- call :checkerror
- :next_1
- cls
- echo Bitrate (Kb/s) to convert with?
- echo (Note: Try a number anywhere from around 2000 to 5000)
- echo.
- set /p "BITRATE=Bitrate: "
- :choice
- cls
- echo Would you like to trim the file?
- echo.
- echo 1) Yes
- echo 2) No
- echo.
- set /p "CHOICE=Choice: "
- if "%CHOICE%" == "1" (goto trim)
- if "%CHOICE%" == "2" (set "TRIM_START=" & set "TRIM_TIME=" & goto convert) ^
- else cls & echo Not a valid choice!
- echo.
- echo Restarting...
- timeout /t 5 /nobreak > nul
- goto :start
- :trim
- cls
- echo Time from the beginning to start trimming?
- echo (Note: Time can be in the form HH:MM:SS, MM:SS, or S)
- echo (Note: Leave blank to start at the beginning of the video)
- echo.
- set /p "TRIM_START=Time: "
- if errorlevel 1 (
- set "TRIM_START=-ss 0"
- ) else (
- set "TRIM_START=-ss %TRIM_START%"
- )
- VERIFY > nul
- cls
- echo Amount of time from starting trim point?
- echo (Note: Time can be in the form HH:MM:SS, MM:SS, or S)
- echo (Note: Leave blank to go to the end of the video)
- echo.
- set /p "TRIM_TIME=Time: "
- if errorlevel 1 (
- set "TRIM_TIME="
- ) else (
- set "TRIM_TIME=-t %TRIM_TIME%"
- )
- VERIFY > nul
- ::==============================================================================================
- :convert
- set "OUTPUT_FILE=%INPUT_FILE:~0,-4%"
- cls
- cd "%DIR_FFMPEG%"
- ffmpeg %TRIM_START% %TRIM_TIME% -i "%INPUT_FILE%" -an -c:v libvpx -crf 32 -b:v %BITRATE%K -vf scale=-1:480 -threads 4 -fs 2.90M -quality best -lag-in-frames 16 -pass 1 -auto-alt-ref 1 -f webm -y nul
- ffmpeg %TRIM_START% %TRIM_TIME% -i "%INPUT_FILE%" -an -c:v libvpx -crf 32 -b:v %BITRATE%K -vf scale=-1:480 -threads 4 -fs 2.90M -quality best -lag-in-frames 16 -pass 2 -auto-alt-ref 1 -f webm -y "%OUTPUT_FILE%.webm"
- echo.
- echo Task completed!
- pause
- exit
- ::==============================================================================================
- :checkerror
- if errorlevel 1 (
- goto none
- ) else (
- set INPUT_FILE=%INPUT_FILE:"=%
- goto next_1
- )
- exit /b
- :none
- cls
- echo No file selected.
- echo.
- echo Restarting...
- timeout /t 3 /nobreak > nul
- cls
- goto start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement