First of all, let me not that MP4 is not a format, but a method of compression. Those media files are not as simple as you might think. They are organized as
containers which can combine different compression method for video, audio and other data, such as subtitles, and more. The term "format" refers to containers, not compression algorithms. Usually, compression is handled separately by
codecs installed in the system. If these two levels (containers and compression standards) did not exist, the combination would not be possible.
Please see:
http://en.wikipedia.org/wiki/Container_format_%28digital%29[
^],
http://en.wikipedia.org/wiki/MPEG-4[
^],
http://en.wikipedia.org/wiki/Codec[
^].
The best open-source product I ever used is not based on codecs installed in the system but uses the big set of the codecs embedded in the library. This is FFmpeg or related libavcodec:
http://en.wikipedia.org/wiki/FFmpeg[
^],
http://en.wikipedia.org/wiki/Libavcodec[
^],
http://ffmpeg.org/[
^],
http://libav.org/[
^].
Unfortunately, these products are not for .NET, they are written in C. Anyway, you could use them with .NET.
Now, how to use it programmatically in a .NET application? First, you can use the available utility by running it using
System.Diagnostics.Process.Start
:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[
^].
If this is not good enough, you can wrap the library in a .NET assembly by yourself or find appropriate wrapper. Please see:
http://www.ffmpeg-csharp.com/[
^],
http://sourceforge.net/projects/sharpffmpeg/[
^],
http://vbffmpegwrapper.codeplex.com/[
^].
After all, try to find some more:
http://bit.ly/VpboUJ[
^].
If you wish to work at such wrapper by yourself but don't know how, ask a question, I'll give you the basic ideas (using P/Invoke or C++/CLI "mixed-mode" project).
Good luck,
—SA