Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine the CODECS value for a m3u8 playlist?

I am creating a master m3u8 file to allow adaptive streaming of two streaming videos. Both have the readable codec name MPEG-4 AVC (part 10) (avc1)

How can I translate this into the CODECS value that should appear in my master m3u8 playlist file, as in this example:

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1755600,CODECS="avc1.42001f,mp4a.40.2",RESOLUTION=354x240

How do I get the value to replace avc1.42001f,mp4a.40.2

Apple's specs say "Valid format identifiers are those in the ISO file format name space defined by RFC 6381 [RFC6381]" but I have no idea how to read the RFC 6381 documentation.

like image 692
arrr_matey Avatar asked Oct 11 '25 11:10

arrr_matey


1 Answers

Each codec string is codec specific. For audio, mp4a indicate its mpeg audio 40 means its mpeg 4.0 (I think) and the last integer is the "audio object type". AAC-LC is 2. The full list can be found here. https://wiki.multimedia.cx/index.php/MPEG-4_Audio#Audio_Object_Types

For video, in your example case, The video codec is h.264, also known as "advanced video codec" aka avc1. The hex string is 3 bytes representing the codec profile, flags, and level. Those can be found in the first 3 bytes the the SPS.

Other codecs are different.

like image 75
szatmary Avatar answered Oct 15 '25 09:10

szatmary



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!