-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
190 lines (176 loc) · 7.31 KB
/
index.html
File metadata and controls
190 lines (176 loc) · 7.31 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<!-- Make a file input for you to select an MKV -->
<center>
<input type="file">
<br>
<textarea id="out" rows="40" cols="120">Et alors ?? Choisissez un fichier type MKV ou WebM </textarea>
</center>
<!-- Include MP$.js -->
<script src="MKVInfo.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function duree(s) {
function onetotwo(Pint) {
if (Pint < 10) {
return '0' + Pint.toString();
} else {
return Pint.toString();
}
}
function onetothree(Pint) {
if (Pint < 10) {
return '00' + Pint.toString();
} else {
if (Pint < 100) {
return '0' + Pint.toString();
} else {
return Pint.toString();
}
}
}
let out = '';
let lhh = '';
let lmn = '';
let lss = '';
let lms = '';
lhh = Math.floor(s / 3600);
lmn = Math.floor((s - lhh * 3600) / 60);
lss = Math.floor(s - lhh * 3600 - lmn * 60);
lms = Math.ceil((s - lhh * 3600 - lmn * 60 - lss) * 1000);
if (lhh > 0) {
lhh = lhh.toString() + ":";
out = lhh;
}
if (lmn > 0) {
if (out.length == 0) {
out = lmn.toString() + ":";
} else {
out = out + onetotwo(lmn) + ":";
}
} else {
if (out.length > 0) {
out = out + "00:";
}
}
if (lss > 0) {
if (out.length == 0) {
out = lss.toString();
} else {
out = out + onetotwo(lss);
}
} else {
if (out.length == 0) {
out = "0";
} else {
out = out + "00";
}
}
if (lms != 0) {
out = out + '.' + onetothree(lms);
}
return out;
}
function humanFileSize(size) {
let i = Math.floor(Math.log(size) / Math.log(1024));
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['o', 'ko', 'Mo', 'Go', 'To'][i];
};
function humanBitrate(size) {
let i = Math.floor(Math.log(size) / Math.log(1024));
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['bps', 'kbps', 'Mbps', 'Gbps', 'Tbps'][i];
};
function human_reading(info) {
info.text = "ArouG's MKV/WebM Infos :\n";
info.text += "-------------------\n";
info.text += "File : " + info.filename + "\n";
let d= new Date(info.filedate);
info.text += "Date : " + (d.getFullYear()) + '/' + (d.getMonth() + 1) + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + "\n";
info.text += "Size : " + humanFileSize(info.filesize) + "\n";
info.text += "Format : "+info.typemovie+"\n";
if (info.UID){
info.text += "UniqueID : "+info.UID+"\n";
}
if (info.WritingLibrary) {
info.text += "Writing library : "+info.WritingLibrary+"\n";
}
info.text += "Duration : " + duree(info.dureeS) + "\n";
GlobBitrate = 8 * info.filesize / info.dureeS;
info.text += "Global bitrate : " + humanBitrate(GlobBitrate) + "\n";
if (info.Creator){
info.text += "Creator : " + info.Creator + "\n";
}
info.text += "Count of streams : " + info.tracks.length + "\n";
info.text += "\n";
for (let i = 0; i < info.tracks.length; i++) {
if (info.tracks[i].typeEnt == 'Video'){
info.text += "Video :\n";
}
if (info.tracks[i].typeEnt == 'Audio'){
info.text += "Audio :\n";
}
if (info.tracks[i].typeEnt == 'Subtitles'){
info.text += "Subtitles :\n";
}
info.text += "Track number " + info.tracks[i].Id + "\n";
if (info.tracks[i].typeEnt == 'Video' && (info.tracks[i].ConstantFramerate)){
let nbf=parseInt(info.dureeS * info.tracks[i].ConstantFramerate) + 1;
info.text += "Count of samples : " + nbf + "\n";
}
if (info.tracks[i].langage){
info.text += "Langage : " + info.tracks[i].langage + "\n";
}
if (info.tracks[i].name){
info.text += "Name : " + info.tracks[i].name + "\n";
}
info.text += "Default : " + info.tracks[i].default + "\n";
info.text += "Forced : " + info.tracks[i].forced + "\n";
if (info.tracks[i].typeEnt == 'Video') {
if (info.tracks[i].ConstantFramerate){
info.text += "Framerate : " + parseInt(info.tracks[i].ConstantFramerate * 1000) / 1000 + " FPS\n";
}
if (info.tracks[i].Swidth){
info.text += "Width on screen : " + info.tracks[i].Swidth + "\n";
info.text += "Heidth on screen : " + info.tracks[i].Sheight + "\n";
}
info.text += "Width in file : " + info.tracks[i].width + "\n";
info.text += "Heidth in file : " + info.tracks[i].height + "\n";
//info.text += "Codec Video more info :\n";
if (info.tracks[i].CodeC) {
info.text += "CodeC : " + info.tracks[i].CodeC + "\n";
}
}
if (info.tracks[i].typeEnt == 'Audio') {
//info.text += "Codec Audio more info :\n";
if (info.tracks[i].CodeC) {
info.text += "CodeC : " + info.tracks[i].CodeC + "\n";
}
info.text += "Count of channels : " + info.tracks[i].nbChannels + "\n";
info.text += "SampleRate : " + info.tracks[i].Freq + "\n";
}
if (info.tracks[i].typeEnt == 'Subtitles') {
if (info.tracks[i].CodeC) {
info.text += "CodeC : " + info.tracks[i].CodeC + "\n";
}
}
info.text += "\n";
}
return info.text;
}
document.querySelector('input[type="file"]').onchange = function(e) {
mkv(this.files[0], function(err, info) {
if (err) {
console.log('error : ' + err);
} else {
sortie_texte = human_reading(info);
//console.log(JSON.stringify(info));
document.querySelector('#out').innerHTML = "";
document.querySelector('#out').innerHTML = sortie_texte;
}
});
}
</script>
</body>
</html>