I need to accept only MP4 videos and WMV videos in a Django web app I am building. For that, I am checking the mime type of the file once it hits the server.
As far as I understand, MP4 files have 'video/mp4' mime type, which is exactly what I am receiving on my web app. The problem comes with the WMV files, which according to every site I found (e.g.: this and that) should have 'video/x-ms-wmv' as the mime type. When I get this files on the server and I inspect them using python-magic
I get 'video/x-ms-asf' as its mime type.
I have converted some youtube videos to WMV videos using different online converters but the result is always the same.
So actually, I do not know what am I doing wrong here.
- Maybe I have a problem of concets, where WMV videos can also have 'video/x-ms-asf' mime type, and not only 'video/x-ms-wmv'
- Maybe
python-magic
is not reading the mime type correctly, which I think would be hardly the case.
Any help is deeply appreciated.
As a side note, I am using python-magic
instead of django's file.content_type
because the second is not reliable. Just change the file's extension to the wrong one and file.content_type
will give the extention mime type instead of the real one.