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 |
| |||
| 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."); } } |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/c-programming/1728-encoding-wmv-file-c-net.html | |||
| Posted By | For | Type | Date |
| Encoding WMV file in C# .Net | Web Hosting | This thread | Refback | 01-01-2008 07:58 PM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| File extension of the code file & object repository file in QTP | vigneshgets | Testing Tools | 1 | 01-16-2008 11:43 PM |
| How can I extract just the extension file name from a forms file upload field? | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 10-22-2007 08:32 AM |
| Difference between a file and Random access file Classes | anbuchezhians | Java Programming | 1 | 08-08-2007 02:53 AM |
| 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 |