mimetype icon indicating copy to clipboard operation
mimetype copied to clipboard

File type is mismatched from audio/mp4 to video/mp4.

Open zimdo opened this issue 4 years ago • 3 comments

audio/mp4

Expected mime type audio/mp4

Returned mime type video/mp4

Version of the library you are using 1.1

Output of go version go version go1.14 darwin/amd64

Additional context The code assumes that the header is at a fixed byte. That doesn't seem to be the case. The file above contains some header info that Android wrote into the file thus the ftyp=m4a is offset from where you expect it.

func (fSig ftypSig) detect(in []byte) bool {
	return len(in) > 12 &&
		bytes.Equal(in[4:8], []byte("ftyp")) &&
		bytes.Equal(in[8:12], fSig)
}

zimdo avatar Aug 04 '20 22:08 zimdo

Sorry for the late response. I will have a look at this, but can you please upload the sample file again. If you want, you can also describe how you generated the troublesome file so I can do it myself.

gabriel-vasile avatar Aug 28 '20 19:08 gabriel-vasile

The file was generated on Android. I can't easily get you the code... but apparently there can be meta information in the file and thus shifting the position of the ftyp header.

zimdo avatar Aug 28 '20 19:08 zimdo

Alright, then just reupload it. I won't miss it this time.

gabriel-vasile avatar Aug 29 '20 15:08 gabriel-vasile