前端获取视频编码
https://github.com/gpac/mp4box.js
var MP4Box = require('mp4box'); // Or whatever import method you prefer.
var mp4boxfile = MP4Box.createFile();
mp4boxfile.onError = function(e) {};
mp4boxfile.onReady = function(info) {
// info -> codec
{
"duration":360002,
"timescale":600,
"isFragmented":false,
"isProgressive":true,
"hasIOD":true,
"brands":["isom"],
"created":"2014-04-15T18:24:40.000Z",
"modified":"2014-04-15T18:24:40.000Z",
"tracks":[
{
"id":2,
"created":"2012-02-13T23:07:31.000Z",
"modified":"2014-04-16T12:22:56.000Z",
"movie_duration":360000,
"layer":0,
"alternate_group":0,
"volume":0,
"track_width":320,
"track_height":180,
"timescale":25000,
"duration":15000000,
"bitrate":120000,
"codec":"avc1.42c00d",
"video":{
"width":320,"height":180
},
"language":"und",
"nb_samples":15000
},
{
"id":3,
"created":"2012-09-12T11:14:57.000Z",
"modified":"2014-04-16T12:22:56.000Z",
"movie_duration":360002,
"layer":0,
"alternate_group":0,
"volume":1,
"track_width":0,
"track_height":0,
"timescale":44100,
"duration":26460160,
"bitrate":60000,
"codec":"mp4a.40.2",
"audio":{
"sample_rate":44100,
"channel_count":1,
"sample_size":16
},
"language":"und",
"nb_samples":25840
}
]
}
};

浙公网安备 33010602011771号