selsta / hlsdl

C program to download VoD HLS (.m3u8) files
MIT License
636 stars 158 forks source link

Warning: Unknown segment type! AAC file #120

Open dr4mohamed opened 2 years ago

dr4mohamed commented 2 years ago

Hi, i'm python developer, i need to decrypt sample-aes , i read this article https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Encryption/Encryption.html after same tests i can't get it work but after testing your script i get this problem :

i have m3u8 playlist ( 3 video quality and 3 audio ) the problem when i select video and audio ( no audio output) when i select only the audio i get Unknown segment type can you help me please ?? the problem with TS_SYNC_BYTE (in live stream) + AAC segment if possible to make ACC decypt and AVC decrypt only on sgement with CLI stdin stdout ?

thanks.

dr4mohamed commented 2 years ago

AAC segment key : 0f2c901630a0f85cf1864227a38bccfc

Encrypted_AAC_Frame () {
--
ADTS_Header                        // 7 or 9 bytes
unencrypted_leader                 // 16 bytes
while (bytes_remaining() >= 16) {
encrypted_block                // 16 bytes
}
unencrypted_trailer                // 0-15 bytes
}

1.zip

dr4mohamed commented 2 years ago

AAC packet first bytes..

[mohamed@l0c4lh0st vod]$ xxd -b 1.aac  |head
00000000: 01001001 01000100 00110011 00000100 00000000 00000000  ID3...
00000006: 00000000 00000000 00000000 01111000 01010000 01010010  ...xPR
0000000c: 01001001 01010110 00000000 00000000 00000000 00110101  IV...5
00000012: 00000000 00000000 01100011 01101111 01101101 00101110  ..com.
00000018: 01100001 01110000 01110000 01101100 01100101 00101110  apple.
0000001e: 01110011 01110100 01110010 01100101 01100001 01101101  stream
00000024: 01101001 01101110 01100111 00101110 01110100 01110010  ing.tr
0000002a: 01100001 01101110 01110011 01110000 01101111 01110010  anspor
00000030: 01110100 01010011 01110100 01110010 01100101 01100001  tStrea
00000036: 01101101 01010100 01101001 01101101 01100101 01110011  mTimes

`

selsta commented 2 years ago

That sample-aes code part was merged back upstream from a fork years ago and I'm honestly not familiar with it anymore.