-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFfmpegVideoCodecs.php
59 lines (53 loc) · 1.59 KB
/
FfmpegVideoCodecs.php
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
<?php
Class FfmpegVideoCodecs {
static function videoTypeByCodec($codec) {
$codec = strtolower($codec);
if (strpos($codec, "flv") !== FALSE)
return "flv";
if (strpos($codec, "h264") !== FALSE)
return "mp4";
if (strpos($codec, "vp8") !== FALSE)
return "webm";
if (strpos($codec, "vp9") !== FALSE)
return "webm";
return "unknown";
}
static function videoTypeByCodecAndFileName($codec, $filename) {
$codec = strtolower($codec);
if (strpos(strtolower($filename), ".mov") !== FALSE)
return "mov";
if (strpos(strtolower($filename), ".m4v") !== FALSE)
return "m4v";
if (strpos(strtolower($filename), ".mkv") !== FALSE)
return "mkv";
if (strpos(strtolower($filename), ".avi") !== FALSE)
return "avi";
if (strpos(strtolower($filename), ".mp4") !== FALSE && strpos($codec, "av1") !== FALSE)
return "mp4-av1";
if (strpos($codec, "flv") !== FALSE)
return "flv";
if (strpos($codec, "h264") !== FALSE)
return "mp4";
if (strpos($codec, "vp8") !== FALSE)
return "webm";
if (strpos($codec, "vp9") !== FALSE)
return "webm";
return "unknown";
}
static function videoSubTypeByCodec($codec) {
$codec = strtolower($codec);
if (strpos($codec, "flv") !== FALSE)
return "regular";
if (strpos($codec, "h264") !== FALSE) {
if (strpos($codec, "baseline") !== FALSE)
return "baseline-slowstart";
}
return "other";
}
static function audioSubTypeByCodec($codec) {
$codec = strtolower($codec);
if (strpos($codec, "opus") !== FALSE)
return "opus";
return "other";
}
}