javaquicktime

Detecting Quicktime MOV File Type using java


Please consider that I have an xml file which has the binary content of an MOV file.

For example:

<MyFile>AAAAFGZ0eXBxdCAgA.......</MyFile>

How to detect that the content, inside that customised MyFile tag, is an MOV file.

For example, for MPEG video file, the condition that we put to check whether the file is an MPEG file is:

if (array[0] == (byte)0 && array[1] == (byte)0 && array[2] == (byte)0x01 && (array[3] == (byte)0xb3 || array[3] == (byte)0xba))

Can anyone please suggest what shall we check for an MOV file.


Solution

  • if (array[4] == (byte)'f' && array[5] == (byte)'t' && array[6] == (byte)'y' && array[7] == (byte)'p')
    

    We may need to check the signature of mov file as "ftyp". https://docs.fileformat.com/video/mov/ As suggested by Cheng Thao, Please refer to this link for more information on the file structures.