Closed iMro0t closed 4 months ago
mp4ff-info yt.mp4
...
[moof] size=4932
[mfhd] size=16 version=0 flags=000000
- sequenceNumber: 1
[traf] size=4081
[tfhd] size=24 version=0 flags=02000a
- trackID: 1
- defaultBaseIsMoof: true
- sampleDescriptionIndex: 1
- defaultSampleDuration: 1500
[tfdt] size=20 version=1 flags=000000
- baseMediaDecodeTime: 1902920531524
[trun] size=3620 version=0 flags=000e01
- sampleCount: 300
[saiz] size=317 version=0 flags=000000
- defaultSampleInfoSize: 0
- sampleCount: 300
[saio] size=20 version=0 flags=000000
- sampleCount: 1
- offset[1]=4940
[sbgp] size=28 version=0 flags=000000
- groupingType: seig
- entryCount: 1
[sgpd] size=44 version=1 flags=000000
groupingType: seig
- defaultLength: 20
- entryCount: 1
- GroupingType "seig" size=20
- * cryptByteBlock: 0
- * skipByteBlock: 0
- * isProtected: 1
- * perSampleIVSize: 8
- * KID: d23f8402-682f-5011-85b9-c68436ae7323
[pssh] size=77 version=0 flags=000000
- systemID: edef8ba9-79d6-4ace-a3c8-27dcd51d21ed (Widevine)
[pssh] size=750 version=0 flags=000000
- systemID: 9a04f079-9840-4286-ab92-e65be0885f95 (PlayReady)
[mdat] size=3122969
offset[1]=4940 is this offset from saio box has anything to do with senc or getting IV for sample decryption? @tobbee
@iMro0t Yes, it seems that the file creator has put the encryption information at the beginning of the mdat
payload. You can calculate that since the offset in saio
is with respect to the moof
box start. That box has a size of 4932 and the mdat
box has an 8-byte header. => 4940.
This placement of encryption metadata is not forbidden by the standard, but when some of my former colleagues tried something like that out around 10 years ago, some players couldn't play the content, so putting it inside a senc
box is a better bet.
Regarding implementation, I think it is quite tricky to fit it into mp4ff. Allowing the encryption information data to be at any byte position and not only in senc boxes means that the decoder must be able to search to any byte range inside the file, something that is not alway possible. Even worse is the writing back the same file read, where the first data samples are not at the start of the mdat box.
That said, if you want to make a try to support it, I'm OK to review any implementation ideas.
BTW, your sample has a size of 0 as far as I can see, so my attempts to download the file resulted in zero-sized files.
@iMro0t Yes, it seems that the file creator has put the encryption information at the beginning of the
mdat
payload. You can calculate that since the offset insaio
is with respect to themoof
box start. That box has a size of 4932 and themdat
box has an 8-byte header. => 4940.
what about the size of the information. if i start reading from 4940 then where should it ends?
BTW, your sample has a size of 0 as far as I can see, so my attempts to download the file resulted in zero-sized files.
are you sure? i am able to download the sample
wget https://github.com/Eyevinn/mp4ff/assets/25949138/b067cb72-80b4-4c91-945e-ea685c78c27c -O tmp.mp4
@tobbee
i figured out. thanks @tobbee
I am trying to decrypt this sample with mp4ff-decrypt but its giving error
decryptSegment: no senc box in traf
This sample is using CENC encryption but its missing
senc
box. Im not sure butsaio
atom is having offset which might point to something useful insidemdat
sample
https://github.com/Eyevinn/mp4ff/assets/25949138/b067cb72-80b4-4c91-945e-ea685c78c27c
key
a700b9955e90085fd692b1b210659b91
https://github.com/Eyevinn/mp4ff/assets/25949138/b067cb72-80b4-4c91-945e-ea685c78c27c