Skip to main content

Microsoft Silverlight

Answered Question convert all video formats to .wmv in C#RSS Feed

(0)

newbie06
newbie06

Member

Member

0 points

4 Posts

convert all video formats to .wmv in C#

What encoder can I use to convert any video format that is uploaded by the user to a .wmv video format? I would like to use the upload control and C# plus and encoder to accomplish this.

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft
Answered Question

Re: convert all video formats to .wmv in C#

Hi Newbie06,

We need to use the Expression Encoder API to encode the upload video files. 

  1: using (LiveJob job = new LiveJob())

   2:            {
   3:                // Create a new file source from the file name we were passed in
   4:                LiveFileSource fileSource = job.AddFileSource(fileToEncode);
   5:  
   6:                fileSource.PlaybackMode = FileSourcePlaybackMode.Loop;
   7:  
   8:                //Alternatively, enumerate a capture device (not shown here)
   9:  
  10:                job.ActivateSource(fileSource);
  11:  
  12:                WindowsMediaBroadcastOutputFormat outputFormat = new WindowsMediaBroadcastOutputFormat();
  13:  
  14:                // Let's broadcast on the local machine on port 8080
  15:                outputFormat.BroadcastPort = 8080;
  16:  
  17:                // Set the output format on the job
  18:                job.OutputFormat = outputFormat;
  19:  
  20:                // Start encoding
  21:                Console.Out.Write("Press 'x' to stop encoding...");
  22:                job.StartEncoding();
  23:  
  24:                while (Console.ReadKey(true).Key != ConsoleKey.X)
  25:                {
  26:                    // We are waiting for the 'x' key
  27:                }
  28:  
  29:                // Stop our encoding
  30:                Console.Out.WriteLine("Encoding stopped.");
  31:                job.StopEncoding();
  32:            }

See this link:  http://blogs.msdn.com/expressionencoder/archive/2009/07/10/9828866.aspx

Best regards,

Jonathan

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

MayurGondaliya
MayurGon...

Member

Member

4 points

2 Posts

Re: Re: convert all video formats to .wmv in C#

Can you confirm that the below SDK is needed for the conversion to WMV, please? I am new to this at the moment.

 

http://www.microsoft.com/downloads/details.aspx?FamilyId=9A077A3D-58CE-454C-B486-153F0578BE4A&displaylang=en

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities