Convert video from Mp4, avi format to wmv format using C #

I used Microsoft Expression Encoder to add two videos, and this thing works Fine. The problem is that when I tried to add videos other than "wmv", it gives an exception Supported by FileNot

I searched on google but I could not find a solution.

private void button1_Click(object sender, EventArgs e) { MediaItem mediaItem1 = null; Job job = new Job(); job.EncodeProgress += new EventHandler<EncodeProgressEventArgs>(job_EncodeProgress); int count = 0; //video url contains all urls of videos foreach (string x in VideosUrls) { if (count == 0) { mediaItem1 = new MediaItem(x); job.MediaItems.Add(mediaItem1); } else { mediaItem1.Sources.Add(new Source(x)); } count++; } job.OutputDirectory = @"C://videoOutput"; job.Encode(); } 

Is there a way to use AForge.NET or Microsoft Expression Encoder so that I can convert any β€œmp4” video to β€œwmv” programmatically before adding it without sound or loss of quality.

Thanks so much for reading the entire Question :)

+5
source share
1 answer

I would check which version of the Windows Media encoder you have.

The Express Release does not seem to support H.264 encoding.

Reality - you need a MP4 encoding license from MPEG LA. This is probably why only paid versions of Expression Encoder support MPEG 4.

Logically, you cannot convert from one video / audio format to another without loss of quality. WMV files typically contain video encoded in VC-1 and audio encoded in WMA. But the .mp4 file usually contains h.264 and AC-3 video.

So, your final .wmv file should only contain video in VC-1, which would mean decoding h.264 video and encoding it in VC-1. This means a loss of quality.

VideoLan can tell you the codecs used in your .mp4 and .wmv files. See this answer .

+1
source

Source: https://habr.com/ru/post/1203288/


All Articles