-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvideoCompressToWebM.cmd
More file actions
47 lines (40 loc) · 1.38 KB
/
videoCompressToWebM.cmd
File metadata and controls
47 lines (40 loc) · 1.38 KB
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
@echo off
echo ###################################################
echo # Description: Convert video to WebM
echo # Usage: videoCompressToWebM.cmd /path/to/video.mov 1000k [noalpha] [interpolate]
echo # Param 1: Video file
echo # Param 2: Video bitrate (quality)
echo # Param 3 [Optional]: "noalpha" to exclude alpha channel
echo # Param 4 [Optional]: "interpolate" to enable frame interpolation
echo # Requires: ffmpeg
echo ###################################################
REM Check parameters
IF "%~1"=="" (
echo Error: 1st arg must be a video file
exit /b 1
)
IF "%~2"=="" (
echo Error: 2nd arg must be video bitrate
exit /b 1
)
REM Get filename and extension
set "filename=%~1"
set "bitrate=%~2"
set "outputFile=%~n1.webm"
REM Set interpolation filter if specified
set "filter="
IF "%~4"=="interpolate" (
set "filter=-vf minterpolate='fps=60:mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1'"
)
REM Check for noalpha option
IF "%~3"=="noalpha" (
REM Single pass conversion without alpha
ffmpeg -y -i "%filename%" -c:v libvpx-vp9 -b:v %bitrate% %filter% "%outputFile%"
) ELSE (
REM First pass
ffmpeg -y -i "%filename%" -c:v libvpx-vp9 -b:v %bitrate% -pass 1 -an -f null NUL
REM Second pass
ffmpeg -y -i "%filename%" -c:v libvpx-vp9 -b:v %bitrate% -pass 2 %filter% "%outputFile%"
)
REM Complete
echo Success: Video converted to WebM format: %outputFile%