Skip to content

Commit

Permalink
Fix codec parsing for AVC streams (#6077)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qizot committed Jan 8, 2024
1 parent 58022b8 commit 0b0c98a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/mp4-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,12 @@ function parseStsd(stsd: Uint8Array): { codec: string; encrypted: boolean } {
case 'avc1':
case 'avc2':
case 'avc3':
case 'avc4':
// profile + compatibility + level
codec += '.' + toHex(stsd[111]) + toHex(stsd[112]) + toHex(stsd[113]);
case 'avc4': {
// extract profile + compatibility + level out of avcC box
const avcCBox = findBox(sampleEntriesEnd, ['avcC'])[0];
codec += '.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);
break;
}
case 'mp4a': {
const codecBox = findBox(sampleEntries, [fourCC])[0];
const esdsBox = findBox(codecBox.subarray(28), ['esds'])[0];
Expand Down

0 comments on commit 0b0c98a

Please sign in to comment.