views:

58

answers:

1

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. Video hosting sites have opted to recode everything, which I think is the wrong approach because it means either long uploading times or low quality.

A: 

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.

Ben Karel