Upload any video and convert to .mp4 online in .net

Sachin picture Sachin · May 22, 2013 · Viewed 28.6k times · Source

I have a strange requirement. User can upload their video of any format (or a limited format). We have to store them and convert them to .mp4 format so we can play that in our site.

Same requirement also for audio files.

I have googled but I can't get any proper idea. Any help or suggestions....??

Thanks in advance

Answer

Vitaliy Fedorchenko picture Vitaliy Fedorchenko · Sep 8, 2013

You can convert almost any video/audio user files to mp4/mp3 with FFMpeg command line utility. From .NET it can be called using wrapper library like Video Converter for .NET (this one is nice because everything is packed into one DLL):

(new NReco.VideoConverter.FFMpegConverter()).ConvertMedia(pathToVideoFile, pathToOutputMp4File, Formats.mp4)

Note that video conversion requires significant CPU resources; it's good idea to run it in background.