html5 video tag codecs attribute

后端 未结 3 1802
时光说笑
时光说笑 2020-11-29 16:57

I am trying to specify a specific video/audio codec in the video tag using

3条回答
  •  佛祖请我去吃肉
    2020-11-29 17:24

    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.

提交回复
热议问题