TonyValenti / Mime-Detective-clarkis117

Mime type detector for files, byte arrays, and streams, .NET Standard Fork
MIT License
38 stars 9 forks source link

mp4 #33

Open rdcs opened 5 years ago

rdcs commented 5 years ago

I have used your tool very successfully, however, my code returns a null in the following when an mp4 is tested: (The filePath extension is mp4) NSUrl videoFileURL = NSUrl.FromString(filePath); Uri uri = new Uri(videoFileURL.ToString()); StreamReader streamReader = new StreamReader(filePath); FileInfo fileInfo = new FileInfo(filePath);

            Stream stream = streamReader.BaseStream;
            FileType fileType = MimeDetective.FileInfoExtensions.GetFileType(fileInfo);

(The fileType here is null) This code works fine for .mov files (quicktime) but fails with mp4. Please let me know if I am using it incorrectly for these type of files or if there is actually an issue. Thanks!

clarkis117 commented 5 years ago

The library works by attempting to read file headers out of the actual file. MPEG files usually have a decent enough file header for the library to match against. However, it looks like you're on an apple device... Which can get weird as they're not consistent with their mp4 headers.

Do you have a test file that repros this or the first 560 bytes of a file?

Get Outlook for Androidhttps://aka.ms/ghei36


From: rdcs notifications@github.com Sent: Tuesday, May 21, 2019 10:11:40 AM To: clarkis117/Mime-Detective Cc: Subscribed Subject: [clarkis117/Mime-Detective] mp4 (#33)

I have used your tool very successfully, however, my code returns a null in the following when an mp4 is tested: (The filePath extension is mp4) NSUrl videoFileURL = NSUrl.FromString(filePath); Uri uri = new Uri(videoFileURL.ToString()); StreamReader streamReader = new StreamReader(filePath); FileInfo fileInfo = new FileInfo(filePath);

        Stream stream = streamReader.BaseStream;
        FileType fileType = MimeDetective.FileInfoExtensions.GetFileType(fileInfo);

(The fileType here is null) This code works fine for .mov files (quicktime) but fails with mp4. Please let me know if I am using it incorrectly for these type of files or if there is actually an issue. Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclarkis117%2FMime-Detective%2Fissues%2F33%3Femail_source%3Dnotifications%26email_token%3DAA6DNQVYKDPS4HIZ56BPX23PWP7JZA5CNFSM4HOLM7P2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GU7HOCQ&data=02%7C01%7C%7C5c313cf06c004a0cc51808d6ddf63f4e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636940447020033731&sdata=vzGWRAIqC2FvqocW32rhypzW5ZtW2dXc8DTMCg04rKc%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA6DNQUHKYLGAM5FNABHWTLPWP7JZANCNFSM4HOLM7PQ&data=02%7C01%7C%7C5c313cf06c004a0cc51808d6ddf63f4e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636940447020043735&sdata=qDQmUiEakYln4FKogdVarn2ZHc9qmGCS8kfRjYPlTW8%3D&reserved=0.

rdcs commented 5 years ago

Thanks for the quick response! Yes, it’s running on IOS in in app I’m writing. I can send you the file and the code I wrote is shown in my text. Let me know if you would like me to send it.

Bob

Sent from my iPhone

On May 21, 2019, at 12:41 PM, Joshua Clark notifications@github.com wrote:

The library works by attempting to read file headers out of the actual file. MPEG files usually have a decent enough file header for the library to match against. However, it looks like you're on an apple device... Which can get weird as they're not consistent with their mp4 headers.

Do you have a test file that repros this or the first 560 bytes of a file?

Get Outlook for Androidhttps://aka.ms/ghei36


From: rdcs notifications@github.com Sent: Tuesday, May 21, 2019 10:11:40 AM To: clarkis117/Mime-Detective Cc: Subscribed Subject: [clarkis117/Mime-Detective] mp4 (#33)

I have used your tool very successfully, however, my code returns a null in the following when an mp4 is tested: (The filePath extension is mp4) NSUrl videoFileURL = NSUrl.FromString(filePath); Uri uri = new Uri(videoFileURL.ToString()); StreamReader streamReader = new StreamReader(filePath); FileInfo fileInfo = new FileInfo(filePath);

Stream stream = streamReader.BaseStream; FileType fileType = MimeDetective.FileInfoExtensions.GetFileType(fileInfo);

(The fileType here is null) This code works fine for .mov files (quicktime) but fails with mp4. Please let me know if I am using it incorrectly for these type of files or if there is actually an issue. Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fclarkis117%2FMime-Detective%2Fissues%2F33%3Femail_source%3Dnotifications%26email_token%3DAA6DNQVYKDPS4HIZ56BPX23PWP7JZA5CNFSM4HOLM7P2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GU7HOCQ&data=02%7C01%7C%7C5c313cf06c004a0cc51808d6ddf63f4e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636940447020033731&sdata=vzGWRAIqC2FvqocW32rhypzW5ZtW2dXc8DTMCg04rKc%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA6DNQUHKYLGAM5FNABHWTLPWP7JZANCNFSM4HOLM7PQ&data=02%7C01%7C%7C5c313cf06c004a0cc51808d6ddf63f4e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636940447020043735&sdata=qDQmUiEakYln4FKogdVarn2ZHc9qmGCS8kfRjYPlTW8%3D&reserved=0. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.