Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zimdo opened this issue Aug 4, 2020 · 3 comments
Open

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

zimdo opened this issue Aug 4, 2020 · 3 comments

Comments

@zimdo
Copy link

zimdo commented Aug 4, 2020

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)
}
@gabriel-vasile
Copy link
Owner

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.

@zimdo
Copy link
Author

zimdo commented Aug 28, 2020

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.

@gabriel-vasile
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants