html5 codecs,html - html5 video tag codecs attribute - Stack Overflow

mark4o gives by far the best explanation I've seen of how to decipher codec information. Excellent.

One piece which may require a little more detail is how to break out the specific audio object type from the decSpecificInfo value. Finding the "mp4a.40" part is very clear, the ".2" section can be a little tricky.

We start with a sequence of single byte hexadecimal values: "11 90" in mark4o’s example or "12 08" in my case. Both of those are a total of 2 bytes... there may be more values but only the first 2 matter for finding the object type (and usually only the first byte). We're looking for individual bits so convert each digit in the hexadecimal values to binary; there should be 4 binary digits for each hexadecimal digit. Take the first 5 binary digits — 4 from the first hex digit, 1 from the next — and convert that binary value to decimal. Here are the steps:

Example 1 (11 90):

Starting value: 11 90

Separate the hex digits: 1 1 9 0

Convert each digit to binary: 0001 0001 1001 0000

Take the first 5 bits: 0001 0

Combine into binary value: 00010

Convert to decimal: 2

Example 2 (12 08):

Starting value: 12 08

Separate the hex digits: 1 2 0 8

Convert each digit to binary: 0001 0010 0000 1000

Take the first 5 bits: 0001 0

Combine into binary value: 00010

Convert to decimal: 2

They are the same object type in spite of having different decSpecificInfo values.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值