-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
320 lines (308 loc) · 15.7 KB
/
index.html
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html>
<!--
作者:332065255@qq.com
时间:2016-10-20
描述:flv直播分析工具
-->
<html>
<head>
<meta charset="UTF-8">
<title>实时监控FLV直播流,详细分析flv文件</title>
<link rel="stylesheet" href="css/flv.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<style>
</style>
<script type="text/javascript" src="js/vue.js" ></script>
<script type="text/javascript" src="js/LiveFlvParse.js" ></script>
<script type="text/javascript" src="js/bound.js" ></script>
<script>
var frist=false;
function begin(){
if(!frist)
{
frist=true;
Live.init(document.getElementById("exampleInputEmail1").value,"resultTables");
document.getElementById("button1").innerHTML="刷新";
}
else
{
window.location.reload();
}
}
function stop(){
Live.stop();
}
</script>
</head>
<body>
<div class="row main">
<div class="col-md-9 left">
<!--左边-->
<div class="userEdit">
<!--用户操作区
-->
<div class="form-group">
<label for="exampleInputEmail1">请输入Flv直播地址 <mark>FLV直播地址需要跨域,请在flv地址之前加https://cors-anywhere.herokuapp.com/</mark></label>
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="https://cors-anywhere.herokuapp.com/http://123.com/1.flv" value="https://cors-anywhere.herokuapp.com/http://dvr-ws.csslcloud.net/src/AE3C4B5BCABAA3AE9C33DC5901307461.flv">
</div>
<button type="submit" class="btn btn-default" onclick="begin()" id="button1">开始分析</button>
<button type="submit" class="btn btn-default" onclick="stop()" id="button1">停止分析</button>
</div>
<!--<div class="resultTable">-->
<!--<table class="table table-bordered" id="">
<tr>
<td>#</td>
<td>类型</td>
<td>时间戳</td>
<td>编码</td>
<td>帧类型</td>
<td>帧大小</td>
<td>详情</td>
</tr>
</table>-->
<!--<table class="table table-bordered" id="resultTables">-->
<!--<tr class="active"><td>1</td></tr>
<tr class="success"><td>1</td></tr>
<tr class="warning"><td>1</td></tr>
<tr class="danger"><td>1</td></tr>
<tr class="info"><td>1</td></tr>-->
<!--</table>-->
<!--</div>-->
<div class="resultTable" id="detailTable">
<!--<table class="table table-bordered" id="">
<tr>
<td>#</td>
<td>类型</td>
<td>时间戳</td>
<td>编码</td>
<td>帧类型</td>
<td>帧大小</td>
<td>详情</td>
</tr>
</table>-->
<table class="table table-bordered" id="resultTables">
<thead>
<tr>
<td>#</td>
<td>类型</td>
<td>时间戳</td>
<td>编码</td>
<td>帧类型</td>
<td>帧大小</td>
<td>详情</td>
</tr>
</thead>
<tbody>
<!--<tr v-for="(detail,index) in details" :class="[detail.type=='video'?(detail.keytype=='KeyFrame'?'success2':'success3'):(detail.type=='script'?'active2':'info2')]">-->
<tr v-for="(detail,index) in details" :class="getTrClass(index)">
<td>{{index}}</td>
<td>{{detail.type}}</td>
<td>{{detail.time}}</td>
<td>{{detail.code}}</td>
<td>{{detail.keytype}}</td>
<td>{{detail.framesize}}</td>
<td><button v-on:click='getDetail(index)'>详情</button></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-3 right" id="detailTxt">
<!--右边-->
</div>
</div>
</body>
<script>
var dropbox=document.querySelector('body');
dropbox.addEventListener("dragover", function(e) {
e.stopPropagation();
e.preventDefault();
}, false);
dropbox.addEventListener("drop", function(e) {
e.stopPropagation();
e.preventDefault();
var reader = new FileReader();
reader.addEventListener("load", processflv, false);
reader.readAsArrayBuffer(e.dataTransfer.files[0]);
}, false);
function processflv(e) {
var buffer = e.target.result;
var uint8 = new Uint8Array(buffer);
//将拖拽入的flv视频转成了2进制数组
window.Tagarr=(flvParse.setLocFlv(uint8))//仍入转换器
// for(var ins=0;ins<arr.length;i++){
// v_table.addDetail(arr[i].tagType,arr[i].getTime(),"xxx",)
// }
parseTags(Tagarr);
// var flv2mp4 = new flv2fmp4();
// flv2mp4.setflv(buffer);
// flv2mp4.onInitSegment = onInitSegment.bind(_this);
// flv2mp4.onMediaSegment = onMediaSegment.bind(_this);
}
function addArr(uint8,arr){
for(var i=0;i<uint8.length;i++){
arr.push(uint8[i]);
}
}
function getSize2(tag){
let length=parseInt(tag,16);
// console.log('长度',)
var str=tag.toString(16)
let num=8-str.length;
for(let i=0;i<num;i++){
str="0"+str;
}
var arr=[];
// str.subStr
arr.push(parseInt(str.substr(0,2),16))
arr.push(parseInt(str.substr(2,2),16))
arr.push(parseInt(str.substr(4,2),16))
arr.push(parseInt(str.substr(6,2),16))
let uint8=new Uint8Array(4);
uint8.set(arr,0);
// console.log(str,arr,uint8);
return uint8;
}
function parseTags(arr){
for(var i=0;i<(arr.length>100?100:arr.length);i++)
{
var tag={};
var bodys=[];
bodys.push(arr[i].tagType);
addArr(arr[i].Timestamp,bodys);
addArr(arr[i].dataSize,bodys);
addArr(arr[i].StreamID,bodys);
addArr(arr[i].body,bodys);
addArr(getSize2(bodys),bodys);
tag.bodys=bodys;
arr[i].bodys2=bodys;
// _this.testIndex+=1;
tag.id=i;
switch(arr[i].tagType) ///解析标签类型
{
case parseInt("8",16):
tag.type="audio";
break;
case parseInt("9",16):
tag.type="video";
break;
case parseInt("12",16):
tag.type="script";
break;
}
tag.time=arr[i].getTime();
if(tag.type!="script")
{
if(tag.type=="video")
{
// var te=<<4
switch(arr[i].body[0]&0x0f)
{
case 1:
tag.ecode="JPEG";
break;
case 2:
tag.ecode="H.263";
break;
case 3:
tag.ecode="Screenvideo";
break;
case 4:
tag.ecode="On2 VP6";
break;
case 5:
tag.ecode="On2 VP6 alpha";
break;
case 6:
tag.ecode="Screen video 2";
break;
case 7:
tag.ecode="AVC/H264";
break;
}
}
else
{
switch(arr[i].body[0]>>4)
{
case 0:
tag.ecode="Linear PCM";
break;
case 1:
tag.ecode="ADPCM";
break;
case 2:
tag.ecode="MP3";
break;
case 3:
tag.ecode="linear PCM,little";
break;
case 4:
tag.ecode="Nelly 16-khz";
break;
case 5:
tag.ecode="Nelly 8-kHz";
break;
case 6:
tag.ecode="Nellymoser";
break;
case 7:
tag.ecode="G.711 A-law";
break;
case 8:
tag.ecode="G.711 mu-law";
break;
case 9:
tag.ecode="reserved";
break;
case 10:
tag.ecode="AAC";
break;
case 14:
tag.ecode="MP3 8-khz";
break;
case 15:
tag.ecode="Device-specific";
break;
}
}
}
else{
tag.ecode="-";
}
if(tag.type=="video")
{
switch(arr[i].body[0]>>4)
{
case 1:
tag.tagType="KeyFrame";
break;
case 2:
tag.tagType="InterFrame";
break;
case 3:
tag.tagType="disposaIframe";
break;
case 4:
tag.tagType="gener Keyframe";
break;
case 5:
tag.tagType="videoinfo";
break;
}
}
else{
tag.tagType="-";
}
// table.addTr(tag);
v_table.addDetail(tag.type,tag.time,tag.ecode,tag.tagType,tag.bodys.length)
}
}
let metadata_error = new Array();
metadata_error = metadata_error.concat([70, 76, 86, 1, 5, 0, 0, 0, 9]);
metadata_error = metadata_error.concat([0, 0, 0, 9]);
metadata_error = metadata_error.concat([18, 0, 6, 146, 0, 0, 0, 0, 0, 0, 0, 2, 0, 10, 111, 110, 77, 101, 116, 97, 68, 97, 116, 97, 8, 0, 0, 0, 26, 0, 7, 99, 114, 101, 97, 116, 111, 114, 2, 0, 5, 127, 128, 223, 128, 247, 0, 15, 109, 101, 116, 97, 100, 97, 116, 97, 99, 114, 101, 97, 116, 111, 114, 2, 0, 51, 89, 101, 116, 32, 65, 110, 111, 116, 104, 101, 114, 32, 77, 101, 116, 97, 100, 97, 116, 97, 32, 73, 110, 106, 101, 99, 116, 111, 114, 32, 102, 111, 114, 32, 70, 76, 86, 32, 45, 32, 86, 101, 114, 115, 105, 111, 110, 32, 49, 46, 57, 0, 12, 104, 97, 115, 75, 101, 121, 102, 114, 97, 109, 101, 115, 1, 1, 0, 8, 104, 97, 115, 86, 105, 100, 101, 111, 1, 1, 0, 8, 104, 97, 115, 65, 117, 100, 105, 111, 1, 1, 0, 11, 104, 97, 115, 77, 101, 116, 97, 100, 97, 116, 97, 1, 1, 0, 12, 99, 97, 110, 83, 101, 101, 107, 84, 111, 69, 110, 100, 1, 1, 0, 8, 100, 117, 114, 97, 116, 105, 111, 110, 0, 64, 114, 196, 69, 161, 202, 192, 131, 0, 8, 100, 97, 116, 97, 115, 105, 122, 101, 0, 65, 144, 208, 249, 236, 0, 0, 0, 0, 9, 118, 105, 100, 101, 111, 115, 105, 122, 101, 0, 65, 143, 67, 253, 72, 0, 0, 0, 0, 9, 102, 114, 97, 109, 101, 114, 97, 116, 101, 0, 64, 62, 2, 140, 152, 59, 120, 2, 0, 13, 118, 105, 100, 101, 111, 100, 97, 116, 97, 114, 97, 116, 101, 0, 64, 154, 157, 174, 129, 13, 1, 27, 0, 12, 118, 105, 100, 101, 111, 99, 111, 100, 101, 99, 105, 100, 0, 64, 28, 0, 0, 0, 0, 0, 0, 0, 5, 119, 105, 100, 116, 104, 0, 64, 148, 0, 0, 0, 0, 0, 0, 0, 6, 104, 101, 105, 103, 104, 116, 0, 64, 134, 128, 0, 0, 0, 0, 0, 0, 9, 97, 117, 100, 105, 111, 115, 105, 122, 101, 0, 65, 82, 153, 249, 128, 0, 0, 0, 0, 13, 97, 117, 100, 105, 111, 100, 97, 116, 97, 114, 97, 116, 101, 0, 64, 94, 199, 152, 68, 188, 118, 72, 0, 12, 97, 117, 100, 105, 111, 99, 111, 100, 101, 99, 105, 100, 0, 64, 36, 0, 0, 0, 0, 0, 0, 0, 15, 97, 117, 100, 105, 111, 115, 97, 109, 112, 108, 101, 114, 97, 116, 101, 0, 64, 8, 0, 0, 0, 0, 0, 0, 0, 15, 97, 117, 100, 105, 111, 115, 97, 109, 112, 108, 101, 115, 105, 122, 101, 0, 63, 240, 0, 0, 0, 0, 0, 0, 0, 6, 115, 116, 101, 114, 101, 111, 1, 1, 0, 8, 102, 105, 108, 101, 115, 105, 122, 101, 0, 65, 144, 209, 20, 164, 0, 0, 0, 0, 13, 108, 97, 115, 116, 116, 105, 109, 101, 115, 116, 97, 109, 112, 0, 64, 114, 196, 69, 161, 202, 192, 131, 0, 21, 108, 97, 115, 116, 107, 101, 121, 102, 114, 97, 109, 101, 116, 105, 109, 101, 115, 116, 97, 109, 112, 0, 64, 114, 196, 69, 161, 202, 192, 131, 0, 20, 108, 97, 115, 116, 107, 101, 121, 102, 114, 97, 109, 101, 108, 111, 99, 97, 116, 105, 111, 110, 0, 65, 144, 209, 20, 84, 0, 0, 0, 0, 9, 107, 101, 121, 102, 114, 97, 109, 101, 115, 3, 0, 13, 102, 105, 108, 101, 112, 111, 115, 105, 116, 105, 111, 110, 115, 10, 0, 0, 0, 59, 0, 64, 154, 184, 0, 0, 0, 0, 0, 0, 64, 155, 252, 0, 0, 0, 0, 0, 0, 65, 62, 138, 8, 0, 0, 0, 0, 0, 65, 81, 120, 151, 128, 0, 0, 0, 0, 65, 83, 183, 210, 0, 0, 0, 0, 0, 65, 93, 117, 208, 192, 0, 0, 0, 0, 65, 99, 62, 57, 0, 0, 0, 0, 0, 65, 104, 4, 170, 64, 0, 0, 0, 0, 65, 108, 139, 129, 64, 0, 0, 0, 0, 65, 109, 170, 152, 160, 0, 0, 0, 0, 65, 112, 48, 101, 192, 0, 0, 0, 0, 65, 114, 223, 73, 160, 0, 0, 0, 0, 65, 117, 54, 50, 16, 0, 0, 0, 0, 65, 118, 151, 245, 192, 0, 0, 0, 0, 65, 121, 25, 106, 96, 0, 0, 0, 0, 65, 121, 131, 150, 192, 0, 0, 0, 0, 65, 122, 134, 131, 16, 0, 0, 0, 0, 65, 122, 203, 167, 160, 0, 0, 0, 0, 65, 124, 80, 16, 64, 0, 0, 0, 0, 65, 124, 196, 135, 32, 0, 0, 0, 0, 65, 125, 9, 55, 32, 0, 0, 0, 0, 65, 125, 90, 233, 96, 0, 0, 0, 0, 65, 125, 161, 105, 208, 0, 0, 0, 0, 65, 126, 175, 185, 128, 0, 0, 0, 0, 65, 128, 21, 77, 184, 0, 0, 0, 0, 65, 128, 236, 251, 96, 0, 0, 0, 0, 65, 129, 172, 157, 40, 0, 0, 0, 0, 65, 129, 248, 103, 224, 0, 0, 0, 0, 65, 131, 16, 157, 160, 0, 0, 0, 0, 65, 132, 200, 111, 176, 0, 0, 0, 0, 65, 133, 144, 235, 72, 0, 0, 0, 0, 65, 134, 15, 57, 152, 0, 0, 0, 0, 65, 134, 234, 164, 120, 0, 0, 0, 0, 65, 135, 20, 11, 208, 0, 0, 0, 0, 65, 135, 91, 141, 64, 0, 0, 0, 0, 65, 136, 86, 42, 168, 0, 0, 0, 0, 65, 137, 211, 119, 184, 0, 0, 0, 0, 65, 139, 55, 164, 200, 0, 0, 0, 0, 65, 139, 136, 211, 0, 0, 0, 0, 0, 65, 139, 181, 51, 216, 0, 0, 0, 0, 65, 139, 227, 93, 112, 0, 0, 0, 0, 65, 140, 11, 254, 72, 0, 0, 0, 0, 65, 140, 96, 43, 224, 0, 0, 0, 0, 65, 140, 181, 151, 80, 0, 0, 0, 0, 65, 140, 231, 40, 232, 0, 0, 0, 0, 65, 141, 101, 138, 152, 0, 0, 0, 0, 65, 142, 15, 149, 96, 0, 0, 0, 0, 65, 142, 91, 63, 56, 0, 0, 0, 0, 65, 142, 130, 103, 24, 0, 0, 0, 0, 65, 142, 185, 31, 240, 0, 0, 0, 0, 65, 142, 247, 78, 128, 0, 0, 0, 0, 65, 143, 54, 90, 112, 0, 0, 0, 0, 65, 143, 166, 96, 64, 0, 0, 0, 0, 65, 143, 214, 62, 104, 0, 0, 0, 0, 65, 144, 51, 28, 236, 0, 0, 0, 0, 65, 144, 76, 145, 136, 0, 0, 0, 0, 65, 144, 129, 24, 140, 0, 0, 0, 0, 65, 144, 206, 84, 160, 0, 0, 0, 0, 65, 144, 209, 20, 84, 0, 0, 0, 0, 5, 116, 105, 109, 101, 115, 10, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 36, 0, 0, 0, 0, 0, 0, 0, 64, 52, 0, 0, 0, 0, 0, 0, 0, 64, 54, 119, 141, 79, 223, 59, 100, 0, 64, 64, 59, 198, 167, 239, 157, 178, 0, 64, 69, 59, 198, 167, 239, 157, 178, 0, 64, 74, 59, 198, 167, 239, 157, 178, 0, 64, 79, 59, 198, 167, 239, 157, 178, 0, 64, 80, 89, 153, 153, 153, 153, 154, 0, 64, 81, 196, 73, 186, 94, 53, 63, 0, 64, 84, 66, 45, 14, 86, 4, 25, 0, 64, 86, 194, 45, 14, 86, 4, 25, 0, 64, 87, 200, 147, 116, 188, 106, 127, 0, 64, 90, 72, 147, 116, 188, 106, 127, 0, 64, 90, 187, 198, 167, 239, 157, 178, 0, 64, 91, 232, 147, 116, 188, 106, 127, 0, 64, 92, 51, 51, 51, 51, 51, 51, 0, 64, 93, 249, 153, 153, 153, 153, 154, 0, 64, 94, 119, 124, 237, 145, 104, 115, 0, 64, 94, 194, 45, 14, 86, 4, 25, 0, 64, 95, 27, 198, 167, 239, 157, 178, 0, 64, 95, 102, 102, 102, 102, 102, 102, 0, 64, 96, 88, 139, 67, 149, 129, 6, 0, 64, 97, 152, 139, 67, 149, 129, 6, 0, 64, 98, 216, 139, 67, 149, 129, 6, 0, 64, 100, 24, 139, 67, 149, 129, 6, 0, 64, 100, 151, 124, 237, 145, 104, 115, 0, 64, 101, 215, 124, 237, 145, 104, 115, 0, 64, 103, 23, 124, 237, 145, 104, 115, 0, 64, 103, 195, 51, 51, 51, 51, 51, 0, 64, 104, 78, 241, 169, 251, 231, 109, 0, 64, 105, 142, 241, 169, 251, 231, 109, 0, 64, 105, 204, 204, 204, 204, 204, 205, 0, 64, 106, 49, 22, 135, 43, 2, 12, 0, 64, 107, 112, 0, 0, 0, 0, 0, 0, 64, 108, 174, 241, 169, 251, 231, 109, 0, 64, 109, 238, 241, 169, 251, 231, 109, 0, 64, 110, 61, 227, 83, 247, 206, 217, 0, 64, 110, 104, 139, 67, 149, 129, 6, 0, 64, 110, 140, 204, 204, 204, 204, 205, 0, 64, 110, 181, 88, 16, 98, 77, 211, 0, 64, 111, 38, 102, 102, 102, 102, 102, 0, 64, 111, 121, 153, 153, 153, 153, 154, 0, 64, 111, 158, 241, 169, 251, 231, 109, 0, 64, 112, 14, 241, 169, 251, 231, 109, 0, 64, 112, 94, 102, 102, 102, 102, 102, 0, 64, 112, 136, 139, 67, 149, 129, 6, 0, 64, 112, 153, 153, 153, 153, 153, 154, 0, 64, 112, 176, 0, 0, 0, 0, 0, 0, 64, 112, 214, 102, 102, 102, 102, 102, 0, 64, 112, 248, 0, 0, 0, 0, 0, 0, 64, 113, 37, 88, 16, 98, 77, 211, 0, 64, 113, 64, 139, 67, 149, 129, 6, 0, 64, 113, 154, 36, 221, 47, 26, 160, 0, 64, 113, 179, 190, 118, 200, 180, 57, 0, 64, 113, 241, 153, 153, 153, 153, 154, 0, 64, 114, 145, 153, 153, 153, 153, 154, 0, 64, 114, 196, 69, 161, 202, 192, 131, 0, 0, 9, 0, 0, 9]);
metadata_error = metadata_error.concat([0, 0, 6, 157]);
window.Tagarr=(flvParse.setFlv(new Uint8Array(metadata_error)))
</script>
</html>