-
Notifications
You must be signed in to change notification settings - Fork 4
/
ffmpeg_command_test.ts
110 lines (107 loc) · 2.3 KB
/
ffmpeg_command_test.ts
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { assertEquals } from "./dev_deps.ts";
import { Encoding } from "./encoding.ts";
import { FFmpegCommand } from "./ffmpeg_command.ts";
Deno.test({
name: "ffmpeg command default options",
fn() {
const cmd: Array<string> = new FFmpegCommand(new Encoding()).toArray();
assertEquals(cmd, [
"ffmpeg",
"-hide_banner",
"-i",
"pipe:0",
"-progress",
"-",
"-nostats",
"-n",
"pipe:1",
]);
},
});
Deno.test({
name: "ffmpeg command options",
fn() {
const encoding = new Encoding();
encoding.input = "input.mp4";
encoding.output = "output.mp4";
encoding.cwd = Deno.cwd();
encoding.threads = 4;
encoding.binary = "my-ffmpeg";
encoding.override = true;
encoding.format = "mp4";
encoding.audioBitrate = "192k";
encoding.videoBitrate = "1M";
encoding.minVideoBitrate = "1M";
encoding.maxVideoBitrate = "1M";
encoding.videoBufSize = "3M";
encoding.codec = "copy";
encoding.audioCodec = "copy";
encoding.videoCodec = "copy";
encoding.width = 200;
encoding.height = -1;
encoding.frameRate = 24;
encoding.sampleRate = 44100;
encoding.frames = 100;
encoding.audioQuality = 2;
encoding.audioChannels = 2;
encoding.duration = 4;
encoding.loop = 0;
// encoding.rotate = -180;
encoding.noAudio = true;
encoding.noVideo = true;
encoding.logLevel = "repeat+level+verbose";
encoding.args = ["-custom"];
const cmd: Array<string> = new FFmpegCommand(encoding).toArray();
assertEquals(cmd, [
"my-ffmpeg",
"-hide_banner",
"-i",
"input.mp4",
"-progress",
"-",
"-nostats",
"-threads",
"4",
"-loglevel",
"repeat+level+verbose",
"-y",
"-b:a",
"192k",
"-b:v",
"1M",
"-minrate",
"1M",
"-maxrate",
"1M",
"-bufsize",
"3M",
"-vframes",
"100",
"-q:a",
"2",
"-vf",
"scale=200:-1",
// "-metadata:s:v", "rotate=-180",
"-ac",
"2",
"-acodec",
"copy",
"-codec",
"copy",
"-t",
"4",
"-f",
"mp4",
"-r",
"24",
"-an",
"-vn",
"-ar",
"44100",
"-vcodec",
"copy",
"-custom",
"output.mp4",
]);
},
});