-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshrink.cmd
More file actions
51 lines (32 loc) · 986 Bytes
/
shrink.cmd
File metadata and controls
51 lines (32 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@echo off
::setlocal EnableExtensions EnableDelayedExpansion
::title scaling down and compressing video
set USER_PATH=%CD%
set SCRIPT_PATH=%~dp0
set TMP_PATH=%SCRIPT_PATH%\tmp
set BIN_PATH=%SCRIPT_PATH%\bin
:: the lower the value the higher the bitrate (24~30 is a good medium)
set CRF_VAL=%1
set IMG_HEIGHT=%2
set INP_FILE=%~3
set OUTP_FILE=%~4
set TMP_FILE=%TMP_PATH%\%~n3.tmp%~x3
set USAGE_STR="%~nx0 <CRF> <IMG_HEIGHT> <INPUT> [OUTPUT]"
if "%CRF_VAL%" == "" (
echo %USAGE_STR%
exit /b 1
)
if "%IMG_HEIGHT%" == "" (
echo %USAGE_STR%
exit /b 1
)
if "%INP_FILE%" == "" (
echo %USAGE_STR%
exit /b 1
)
if "%OUTP_FILE%" == "" set OUTP_FILE=%INP_FILE%
copy /y /v /d "%INP_FILE%" "%TMP_FILE%"
::TODO: try the -af "volume=1.5" switch to adjust volume after mixing down 5.1 audio
%BIN_PATH%\ffmpeg -y -hwaccel auto -i "%TMP_FILE%" -map_metadata 0 -vcodec libx265 -crf %CRF_VAL% -vf scale=-2:%IMG_HEIGHT% -c:a copy "%OUTP_FILE%"
del /q /f "%TMP_FILE%"
exit /b 0