proper reading of codecs done
This commit is contained in:
parent
7447699735
commit
e94d063422
2 changed files with 8 additions and 2 deletions
|
@ -51,6 +51,7 @@ class VideoLoader {
|
|||
async prepare_buffer() {
|
||||
let init_frag = await this.fetch_video('/vid/' + this.stream_key + '/init.mp4');
|
||||
let mime = (new MP4Tree(init_frag)).get_mime();
|
||||
console.log(mime);
|
||||
}
|
||||
|
||||
async fetch_video(uri) {
|
||||
|
|
|
@ -43,12 +43,17 @@ class MP4Tree {
|
|||
|
||||
parse_avc1() {
|
||||
this.parse_into('avc1', 86);
|
||||
console.log(this.read_next_head());
|
||||
this.parse_into('avcC', 8);
|
||||
const avc_profile = (this.data.getUint32(this.idx) & 0xffffff).toString(16);
|
||||
this.codecs.push('avc1.' + avc_profile);
|
||||
}
|
||||
|
||||
parse_mp4a() {
|
||||
this.parse_into('mp4a', 36);
|
||||
console.log(this.read_next_head());
|
||||
this.parse_into('esds', 12);
|
||||
const oti = this.data.getUint8(this.idx + 13).toString(16);
|
||||
const aot = (this.data.getUint8(this.idx + 31) >> 3).toString(10);
|
||||
this.codecs.push(["mp4a", oti, aot].join('.'));
|
||||
}
|
||||
|
||||
get_mime() {
|
||||
|
|
Loading…
Reference in a new issue