FFmpeg file conversion formats and file extensions

2.8k Views Asked by At

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?

2

There are 2 best solutions below

2
pixelistik On BEST ANSWER

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.

0
Robin Green On

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.