views:

26

answers:

1

Hello,

I'm trying to determine the real type of a file programmatically. It seems I have to use for example FFMPeg for that.

I want to determine if an uploaded file is in fact a MP4 or FLV (for flash videos) [or WebM (for HTML5)]. I know the -i operator in FFMPeg but I don't know what to check for.

For example:

Input #0, flv, from 'c:\www\data.aspbooru\image\0\40c24ba424d1334ef81c88c416ce794e.flv':

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c:\www\data.aspbooru\image\0\8c1a747b5188349d92cca17a502d2d57.mp4':

Those are FFMPeg outputs. Is this all I have to check for when filtering videos for flash?

So, if none of those apply. How do I check for a swf file?

Input #0, swf, from 'c:\www\data.aspbooru\image\0\90447bd30d30ccb1474c0433e948d438.swf':
Duration: 00:07:16.08, start: 0.000000, bitrate: 63 kb/s
Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 64 kb/s
Stream #0.1: Video: flv, yuv420p, 320x240, 25 fps, 25 tbr, 25 tbn, 25 tbc

Is checking for Input #0, swf, enough? It extracts an included flv which I dont want.

Now I also need to check for file types which are completely NOT videos and filetypes which are videos, but could be converted to a mp4 with h.264 (Or Webm?) I have completely no clue how to do this.

The conversion thing can be managed, but hints on that would be very cool too (converting h.264 and webm?).

I input a random file. Is this it? c:\web.config: Invalid data found when processing input

EDIT: No programming language specified because it is independent of any programming language. But I would be grateful for language specific input: VB.NET. You can assume I already have the process logic and the output is there as a string! Regex would be cool too :)