1

I hope someone knows a link to point me to here.

I'm converting different video and audio formats using ffmpeg. I want to only let files with file extensions be converted that are supported by ffmpeg. The supported formats are found here: http://ffmpeg.org/general.html#SEC4

My question: is there a list of file extensions somewhere? I don't want to research for every format which file extensions might be used for that. Or is there a pain-free format-recognition library or class for C#/.NET available, that can scan for a audio/video format?

Akku
  • 4,373
  • 4
  • 48
  • 67
  • 2
    Multimedia files are often *container* files which can contain many different possible *codecs*. Thus you'd sometimes have to look inside the file to see what codecs are being used, to be sure - just looking at the file extension wouldn't necessarily be enough. – Robin Green Apr 13 '11 at 06:58
  • Ah okay. So is there a (hopefully painless) way to recognize the codec inside the container and to determine if it can be used by ffmpeg in C#/.NET? – Akku Apr 13 '11 at 07:01

2 Answers2

1

If you call ffmpeg with just the input file and no other parameters, it will give you information on the contained streams, if it can read them.

ffmpeg -i input.avi

See this answer about identifying files before encoding.

Community
  • 1
  • 1
pixelistik
  • 7,541
  • 3
  • 32
  • 42
  • Thanks ... sad that there's no programmatic way - but this will work. – Akku Apr 13 '11 at 12:18
  • 2
    Or, look at ffprobe. You still need to shell to execute it, but you can get it to dump a JSON output as well: http://stackoverflow.com/questions/7708373/get-ffmpeg-information-in-friendly-way – Eddie Parker Jan 01 '13 at 20:28
0

Can't you just programmatically execute

ffmpeg -i filename -dframes 0 -vn -aframes 0 dummy.avi

and read the output and see if it says "Unsupported codec" or something like that at the end?

That encodes zero audio frames and nothing else into a dummy file. Actually you might need to tweak the options a little, because I'm not sure whether that will check if the video codec is supported.

Robin Green
  • 32,079
  • 16
  • 104
  • 187