This is a discussion on Encoding WMV file in C# .Net within the C# Programming forums, part of the Software Development category; Objective: Encoding WMV files for streaming in C# .NET Steps: 1. Create a windows class library project. 2. You should ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Objective: Encoding WMV files for streaming in C# .NET Steps: 1. Create a windows class library project. 2. You should install windows Media Encoder. 3. Add the windows Media Encoder component reference. 4. Copy and paste the below method inside the class file. If You call this method with inputfilename,outputFilename,encodingProfileName, You will get the encoded WMV file. private void DoEncode(string inputFileName, string outputFilename, string encodingProfileName) { IWMEncSourceGroupCollection srcGrpColl; IWMEncSourceGroup srcGrp; IWMEncSource srcAud; IWMEncVideoSource2 srcVid; IWMEncFile2 outFile; IWMEncProfile2 pro; if (File.Exists(inputFileName) && File.Exists(encodingProfileName))) { encoder = new WMEncoder(); srcGrpColl = encoder.SourceGroupCollection; srcGrp = srcGrpColl.Add("WmvSrc"); srcAud = srcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO); srcVid = (IWMEncVideoSource2)srcGrp.AddSource(WMENC_SOURCE_ TYPE.WMENC_VIDEO); srcAud.SetInput(inputFileName, "", ""); srcVid.SetInput(inputFileName, "", ""); pro = new WMEncProfile2(); pro.LoadFromFile(inputFileName); srcGrp.set_Profile(pro); outFile = (IWMEncFile2)encoder.File; outFile.LocalFileName = outputFilename; encoder.PrepareToEncode(true); encoder.Start(); } else { throw new ApplicationException("File not found."); } } |
|
#2
| |||
| |||
| Thanks Oxygen.. It is very useful to me.. Thanks... S.Balasubramanian.. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to check which text encoding is used using php | ptrckgorman | PHP Programming | 0 | 12-27-2008 07:53 AM |
| Encoding in PHP files | jamilvoss | PHP Programming | 0 | 12-26-2008 12:35 PM |
| encoding and serialization | smithcarvo | ASP and ASP.NET Programming | 1 | 10-11-2008 07:36 PM |
| Serialization and Encoding | vigneshgets | C# Programming | 1 | 08-01-2007 11:37 PM |
| Encoding String | Anandavinayagam | PHP Programming | 0 | 03-29-2007 12:49 AM |
Our Partners |