It depends on what media container and compression algorithm (codec you need to use, MPEG-4/AAC, MPEG-3, WMA) you have to use. If you need something really universal which can do it all, I would advise to use open-source library or utility FFmpeg or libavcodec:
http://en.wikipedia.org/wiki/Ffmpeg[
^],
http://ffmpeg.org/[
^],
http://en.wikipedia.org/wiki/Libavcodec[
^],
http://libav.org/[
^].
For further information, please see my past answer:
How to trim the video using Directshow!?[
^].
You can use one of the .NET
Process
or one of the wrapper to use the library, as explained in the post referenced above, or use .NET P/Invoke yourself, or JNI for Java.
—SA