Is there a command-line tool that sniffs video/audio files and generates detailed content-type strings for them, in the format specified in the HTML5 spec and in RFC4281?
I want to use this serverside to avoid recoding of uploaded MP4 and OGG files whenever the encoding is supported by HTML5 browsers. V开发者_JS百科ideo hosting sites have opted to recode everything, which I think is the wrong approach because it means either long uploading times or low quality.
I don't believe there is any ready-made application that will do this. However, if you're running on a Linux-like environment, the file
utility will identify many filetypes by content sniffing.
file
won't spit out RFC-compliant MIME types directly, but converting its output to whatever MIME types you're interested in should be a pretty simple task.
精彩评论