I downloaded an MP4 file from the /media/<cameraId>.mp4 endpoint but noticed I was getting an error from our MP4 Reader that it was failing to parse one of the boxes in the file. Digging into the bytes, here is what I found:
After the Movie Fragment Random Access Box (mfra) there appears to be some extra data that was appended to the end of the file. It appears to be a kind of signature so that the file can be traced back to the device that created it. However, this extra data does not take the form of a box, but rather seems to be just a raw string. In my case, there were 137 bytes that gives the following string:
"29b5406f33174153aa5b3a63938507fe 86a360fed91db31db7aba52fe24ee605\Hanwha Media Server v184.108.40.206\054173c808591c5ff9e96ed75e3dcc7441\hanwha\"
Per the ISO/IEC 14496-12 document for ISO base media file format under section 4.1 File Structure: "Files are formed as a series of objects, called boxes in this specification. All data is contained in boxes; there is no other data within the file."
This also is less than ideal since the Movie Fragment Random Access Box (mfra) is usually placed at the end of the file, and finishes with the Movie Fragment Random Access Offset Box (mfro). That way the file can be scanned backwards by examining the last 32 bits of the file.
This signature does not need to be removed from the MP4, instead I would suggest it be contained with a Free Space Box (free) and placed before the Movie Fragment Random Access Box (mfra). The Free Space Box (free) is defined in the same document under section 8.1.2 Free Space Box.
The MP4 Spec is rather large, so it's possible I may have missed something.
Please sign in to leave a comment.