Read mp4 metadata [Solved]

I am currently using URL to play MP4 videos. But I would like to define only certain MP4 videos will be supported in my application. So I would like to know how to read the metadata ( video info ) in MP4 videos in Unity in order to get Major Brand ( A.K.A ftyp ) value ( mp41 or custom value ).

After a lot of time wasted, I finally have a solution to retrieve the value of MajorBrand from Mp4 video. I am sharing my solution here, hope it will be able to help other people


FileStream fileStream = new FileStream( filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );

BinaryReader binaryReader = new BinaryReader( fileStream );
binaryReader.BaseStream.Seek( 0, SeekOrigin.Begin );
byte[] verifyArray = binaryReader.ReadBytes( 32 );
binaryReader.Close();

ConvertToString( BitConverter.ToString( verifyArray ) );

private void ConvertToString( string hex )
{
     StringBuilder builder = new StringBuilder();

     string[] splitHex = hex.Split( new char[] { '-' } );
     for (int i = 0; i < splitHex.Length; i++)
     {
          int value = Convert.ToInt32( splitHex*, 16 );*

string stringValue = char.ConvertFromUtf32( value );
char charValue = (char)value;
if( value != 0 )
builder.Append( stringValue );
}
}

Hi there!

Does anyone ( @busyxiang ) knows if the above solution allows somehow to read mp4 video chapters/ markers…?