Click here to Skip to main content
Click here to Skip to main content

Convert MP3, MPEG, AVI to Windows Media Formats

By , 30 May 2005
 

Introduction

The Windows Media Encoder SDK is the latest and the easiest API to build media applications. Many different applications can be developed using the Windows Media Encoder SDK, such as video e-mails, security surveillance archiving, encoders, screen capture utilities, Microsoft PowerPoint and Microsoft Office add-ins, digital recorders, and custom encoding applications. It is built on the Windows Media Format SDK, which provides the lower-level functionality. Unlike the Windows Media Format SDK, which could be used only from C, C++, the Windows Media Encoder SDK supports not only .NET languages, but scripting languages like Visual Basic Scripting Edition, Microsoft JScript, and Microsoft Windows Script Host.

Windows Media Video (WMV) and Windows Media Audio (WMA) are generic names for the set of streaming video and audio technologies developed and controlled by Microsoft. It is part of the Windows Media framework. The DivX video format is originally based on the hacked WMV codec. In this article, I will show how easily you can convert different video/audio formats to WMV and WMA formats. The samples demonstrate AVI, Wav, MP3, MPG, WMA, and WMV conversion to WMA and WMV.

Why Windows Media Formats?

WMV and WMA are designed to handle all types of video and audio contents, respectively. The files can be highly compressed, and can be delivered as a continuous flow of data (on-line radio). WMV and WMA files can be of any size, and be compressed to match many different bandwidths (connection speeds). Other Microsoft media formats like ASF files are similar to the WMV format. Most of all these are Microsoft standard formats.

Requirements for Running the Samples

  • Microsoft .NET Framework
  • Windows Media Encoder 9 Series
  • Interop.WMEncoderLib.dll and Interop.WMPREVIEWLib.dll present with the EXE files

Features

The code contains five projects:

  1. A command-line utility to convert a video file. You give it a source file and a destination file. I made this basically for two purposes:
    • The other application deals with batch conversion, so it is difficult to understand.
    • Many a times, you need an application to do conversion on command line. You can use this application for that, or you can change it to a small library.
  2. A batch conversion utility that automates the process of encoding a group of files without having to configure the encoding session after each file, eliminating the need to wait until encoding is completed before setting properties for the next file.
  3. Joining of two files into one media file. Limitations: It joins only files of the same size and type. Tested on the files present with the project: Source1.avi and Source2.avi.
  4. Splitting a media file into multiple media files. Limitations: Tested on the file present with the project: Source1.avi.
  5. Join 12 images to form a movie. The images are joined with a one second interval. So, in total, the resultant is a 12 sec. movie.

Main Terminologies

What are Profiles?

A profile specifies which codec to use for compression, and determines the number of output streams and their bit rates. Each profile targets a specific audience and destination. For example, one profile might use a quality based variable bit rate (VBR) for a file download, while another profile might use a constant bit rate (CBR) for streaming. Each profile is used for a specific number and type of source streams. Only one profile can be associated with a source group at a time, and the profile must be the same for all source groups in the encoding session.

By default, profiles are present in "C:\Program Files\Windows Media Components\Encoder\Profiles". You may create your own profiles for different audience and ship them with your application. Here is a sample on how to create a custom profile: MSDN.

What are DRM profiles?

DRM (Digital Rights Management) is used to for protecting your encoded content. Content is encoded and then encrypted with a key, and then a license is required for users to play the content. This license contains the key to unlock the content, and the rights that govern its use. For example, the license determines the number of times the content can be played or whether the license expires. See how to create/modify DRM profiles in MSDN.

What are Video Preprocessing Modes?

There are video preprocessing modes such as standard, deinterlacing, inverse telecine, and process interlacing.

What is Two-pass Encoding?

If the selected profile allows it, two-pass encoding can be used to improve the quality of the encoded content.

Running the Code

The console application, split file, and join file examples are fairly simple. So, I will mainly explain the batch encoding part.

  • Select one or multiple files to encode, say C:\WINDOWS\clock.avi in the sources listbox. Give the path of the output folder. I have used SHBrowseForFolder and SHGetPathFromIDList functions from "shell32" for choosing a directory.
  • Provide a prefix string in the output string textbox to identify all the batch outputs for this conversion.
  • Choose a pre-defined profile from the "C:\Program Files\Windows Media Components\Encoder\Profiles" folder.
  • Choose a preprocessor, Standard in most cases, unless the file format supports a different preprocessor.
  • Choose a DRM profile, if available, or make a custom one using the above mentioned links.
  • Enable cropping, if required.
  • Add information on files, like author, description etc.
  • Enable two-pass encoding, if required.
  • Now, click the ADD button over the datagrid to add the sources for encoding.
  • Click the START button to start encoding.
  • If everything goes OK, the sources present in the datagrid will start encoding one after the other.
  • You may check for any errors in the ErrorLog.xml file after checking Tools -> Log Errors.

Process Flow

Below is a high level process flow of how the major components interact with each other. It is fairly simple, and depicts the major components used and their interaction.

Using the Code

Batch encoding application

I have used a struct named strucEncodeInfo for the input parameter of sEncodeFile() to encode a batch. It contains the source file, destination file, the profile to be used, and the DRM profile for any information of the file like title, description, author and any copyright information. It also contains information on whether the encoded output needs to be cropped from any side, or if any kind of video preprocessing is required. Two-pass encoding is done if the profiles support and the boolean is true.

private struct strucEncodeInfo
{
    public string Source;
    public string Destination;
    public string Profile;
    public string DRMProfile;
    public string Title;
    public string Description;
    public string Author;
    public string Copyright;
    public bool Crop;
    public long CropLeft;
    public long CropTop;
    public long CropRight;
    public long CropBottom;
    public WMENC_VIDEO_OPTIMIZATION Preproc;
    public bool TwoPass;
}

Create the global encoder object and attach the OnStateChange event handler. So, when you start encoding, you will be informed via enumState about the state of encoding:

WMEncoder glbEncoder = new WMEncoder();
glbEncoder.OnStateChange+=new 
  _IWMEncoderEvents_OnStateChangeEventHandler(this.Encoder_OnStateChange);

sEnumDRMProfiles() finds out any DRM profiles present and fills the respective combobox. sEnumPreprocess() fills the name of the preprocessors in the respective combobox. The encoding starts from the function sEncodeFile() with glbEncoder.Start(). Now it's time to check if it has been completed or not. The following while loop waits for the glbboolStartNext variable to be set to true, and keeps the GUI responsive.

while (glbboolStartNext == false) 
{
    Application.DoEvents();
}

You may also save sessions and load them afterwards using the menu. You may also save a default session so that you do not need to specify the profiles, output path, and prefix again and again.

Command-line Single File Conversion

It consists of a minimal set of code from batch encoding.

Join Video Files

It consists of two sources in the Source group instead of one, and srcGrp.SetAutoRollover (-1, "SG2"); tells the encoder to encode the second source after the first one is finished. Similarly, you can add as many sources as you want, and you may sequence them one after another or may overlap them.

Split File

The class which is used in this case is WMEncBasicEdit. The input file is set in the BasicEdit.MediaFile property and the output file is set in the BasicEdit.OutputFile property. BasicEdit.MarkIn and BasicEdit.MarkOut are set which indicate marking to cut a file from the starting and the ending position. Mark-in and Mark-out are calculated for different output files to split in equal parts.

Join Images to Form a Movie

It consists of n image sources in the Source group. As still images have no duration, I have used a timer to rollover from one source to another after a time interval. In this example, I have set a timer interval to 1 sec. For this example, I have used a lot of help from a post at microsoft.public.windowsmedia.encoder.

References

  • This is the continuation of my previous article on Windows Media Encoder: Capture Activities on Screen in a Movie.
  • Much help has been taken from a sample present in the Windows Media Encoder SDK in Visual Basic.

Side note: The code may not be foolproof, but it works.

Revision History

  • 25-05-2005
    • Added joining of files.
    • Added splitting of file.
    • Added flow diagram.
    • Added Join Images to form a movie.
  • 12-12-2004
    • Original article.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Armoghan Asif
Architect
Pakistan Pakistan
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionerror showig ..in split file...please tell how to correct that errormembervinaykn.rao17 May '12 - 21:17 
{"Retrieving the COM class factory for component with CLSID {9571D958-9BCF-4E19-A374-FC2F321C8F61} failed due to the following error: 80040154."}
QuestionProblem in DRM profile and preprocessing selection and in browse button of output foldermemberMember 78200334 Jan '12 - 9:34 
there is nothing available in DRM profile and preprocessing for selection i.e. dropdownlist of both is empty. so, how can i get data inside it. moreover when I click on browse button of output folder location it gives system.accessviolation exception and then output hangs.
 
Please help me in removing these errors. because it is necessary for me to run this code.
cse.manishkumar@gmail.com
 

GeneralAudio gets Compressedmemberjugal_piet@indiatimes.com20 Jun '10 - 20:09 
Hi,
I am developing a tool where i need to join two audio files,i am able to join audio,but the problem is that audio is getting compressed.
so quality of output audio is not good.I need help any one please help me.
 
Thank's
Jugal
GeneralFlash version of Movie Makermembereiramave13 Apr '09 - 18:03 
Hi, just want to ask if it is possible to create a movie maker using flash?Here's my email:esketcher07@yahoo.com.thankz!
GeneralRe: Flash version of Movie MakermemberArmoghan Asif14 Apr '09 - 21:21 
Its about using Dotnet and Flash together
 
I think you can do it. If somehow when flash is downloaded, it can download Media Encoder as prerequisite and then it can interact with dotnet , then it could be possible
 
Following links can be helpful
1. http://www.devx.com/dotnet/Article/21033[^][^]
 
2. http://www.flash-control.net/faq.htm[^]
 
Google more for help
Generaltrouble encoding vob to wmv if it has audiomemberdavidluper15 Feb '09 - 14:41 
i can encode VOB files with audio (ac3 audio) in Windows Media Encoder, but
when i use the sdk i can only encode the video from VOB files, if i try to
encode the aduio i get an error that say there was an attempt to read or
write to protected memory. does any one know how i can use the SDK to encode
video and audio from a VOB file? i have tried encoding an avi file with video
and audio and i did not receive this error. and again i can use the media
encoder application and encode these VOB files with audio just fine.
 
i am using an x64 computer and i have WME x64 installed properly and have used it for this
task numerous times.
 
here is the code that i am using, i am converting VOB files with AC3 audio
 
encoder = new WMEncoder();
encoder.OnStateChange += new
_IWMEncoderEvents_OnStateChangeEventHandler(Encoder_OnStateChange);
SrcGrpColl = encoder.SourceGroupCollection;
 
string moviename = "";//[set to the moviename i am working
with];
string[] files = // gets an array of files in the directory
this movie is located
Array.Sort(files);
 
List<IWMEncSourceGroup2> sources = new
List<IWMEncSourceGroup2>();
 
int cnt = 0;
for (int j = 0; j < files.Length; j++)
{
if (!files[j].ToUpper().EndsWith(".VOB")) { continue; }
//if
 
IWMEncSourceGroup2 src =
(IWMEncSourceGroup2)SrcGrpColl.Add("WMVSCR" + cnt.ToString()));
cnt += 1;
 
IWMEncVideoSource2 vidsrc =
(IWMEncVideoSource2)src.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
vidsrc.SetInput(files[j], "", "");
vidsrc.Optimization =
WMENC_VIDEO_OPTIMIZATION.WMENC_VIDEO_DEINTERLACE;
vidsrc.PreProcessPass = 0;
IWMEncAudioSource audsrc =
(IWMEncAudioSource)src.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
audsrc.SetInput(files[j], "", "");
audsrc.PreProcessPass = 0;
 
src.set_Profile(profile_dvdsurround);
 
sources.Add(src);
} //for
 
for (int j = 0; j < sources.Count - 1; j++) {
sources[j].SetAutoRollover(-1, "WMVSCR" + Convert.ToString(j + 1)); } //for
 

 
IWMEncFile2 File = (IWMEncFile2)encoder.File;
try { File.LocalFileName = "C:\\test.wmv"; }
catch (Exception ex) { Console.Error.WriteLine(ex.Message);
return; }
 
try { encoder.PrepareToEncode(true); }
catch (Exception ex) { Console.Error.WriteLine(ex.Message);
return; }
 
try { encoder.Start(); }
catch (Exception ex) { Console.Error.WriteLine(ex.Message);
return; }
 
the profile i am using is this
 
<profile version="589824"
storageformat="1"
name="Custom (CBR)"
description="">
<streamconfig
majortype="{73647561-0000-0010-8000-00AA00389B71}"
streamnumber="1"
streamname="Audio Stream"
inputname="Audio409"
bitrate="768000"
bufferwindow="-1"
reliabletransport="0"
decodercomplexity=""
rfc1766langid="en-us"
>
<wmmediatype subtype="{00000162-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="1"
btemporalcompression="0"
lsamplesize="16384">
<waveformatex wFormatTag="354"
nChannels="6"
nSamplesPerSec="96000"
nAvgBytesPerSec="96000"
nBlockAlign="16384"
wBitsPerSample="24"
codecdata="18003F0000000000000000000000E0000000"/>
</wmmediatype>
</streamconfig>
<streamconfig
majortype="{73646976-0000-0010-8000-00AA00389B71}"
streamnumber="2"
streamname="Video Stream"
inputname="Video409"
bitrate="5000000"
bufferwindow="-1"
reliabletransport="0"
decodercomplexity="AU"
rfc1766langid="en-us"
>
<videomediaprops maxkeyframespacing="20000000"
quality="50"/>
<wmmediatype subtype="{31435657-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="0"
btemporalcompression="1"
lsamplesize="0">
<videoinfoheader dwbitrate="5000000"
dwbiterrorrate="0"
avgtimeperframe="333667">
<rcsource left="0"
top="0"
right="0"
bottom="0"/>
<rctarget left="0"
top="0"
right="0"
bottom="0"/>
<bitmapinfoheader biwidth="0"
biheight="0"
biplanes="1"
bibitcount="24"
bicompression="WVC1"
bisizeimage="0"
bixpelspermeter="0"
biypelspermeter="0"
biclrused="0"
biclrimportant="0"/>
</videoinfoheader>
</wmmediatype>
</streamconfig>
</profile>
GeneralMarkin doesnt work.memberMember 47136735 Jan '09 - 22:59 
Hey Armoghan, thanks for the nice code.
 
Im having problems with basicedits markin.
 
Example:
 
I have a WMV file from AMDs site (http://www.amd.com/us-en/assets/content_type/DownloadableAssets/T64X2_animation.wmv). Its 1½ min long. When I set markin to 45000 and markout to basicedit.duration - 15000, it only cuts the last 15 sec. I have tried with your splitter and even the C# example in the Windows Media Encoder help file.
 
It seems that markin only works on key frames... I have been trying for weeks now.
 
Do you have any idea how to get it to work? All I need is a way to split WMV files.
GeneralNull refrence exception when run samples.memberMember 158232713 Nov '08 - 5:01 
I tried to run your samples but failed with null refrence exception in
 
try
{
glbEncoder.PrepareToEncode(true);
}
catch (Exception ex)
{
Console.Error.WriteLine ( ex.Message);
return false;
}
 

Do you know what it can be. ?
 
EvgenKovalenko

QuestionWhy is the entity of Windows Media Encoder required?memberOnur Guzel20 Oct '08 - 10:19 
Hi,
Thanks for the article, however i have an important question:
 
Though "Interop.WMEncoderLib.dll" and "Interop.WMPREVIEWLib.dll" reside in application's folder, why is user forced to install Windows Media Encoder 9 to make this project work? Shouldn't that project run by itself using the required DLLs which are included in application folder(local)? (bin folder)
 
Is requirement of registering COM GUIDs in registry the reason?
 
It's annoying and needs to be solved.
 
Thanks.
AnswerRe: Why is the entity of Windows Media Encoder required?memberArmoghan Asif22 Oct '08 - 3:32 
Its the same reason. why we need to deploy media player when we are playing a song.. when we have already added its referecne..
 
The dlls added has prereqs.. which are present in Windows Media encoder runtime..
also it is used to get profiles from there.
GeneralRe: Why is the entity of Windows Media Encoder required?memberOnur Guzel22 Oct '08 - 7:57 
What requirements? After you referenced your project, the required DLLs are copied into local application folder. So, being dependent on installation of another software(Windows Media Encoder) is annoying. When a user installs WME 9, they can decide to use WME 9 rather than the application you wrote using its DLLs.
 
Thanks.
GeneralRe: Why is the entity of Windows Media Encoder required?memberArmoghan Asif27 Oct '08 - 23:23 
Think of it from a Business Application point of view..
 
When you give an application, if you require Video capturing to be part of your application or u want to use if in your application for some purpose.. then you can use it..
 
You will not ask your client to Download following application and learn it and do your work..
 
I hope it answers your question
GeneralRe: Why is the entity of Windows Media Encoder required?memberOnur Guzel19 Jan '09 - 8:20 
Actually there is a misdesign or another aim in your project depending on that issue. Here is why:
In your project it seems you have referenced "Interop.WMEncoderLib.dll" and "Interop.WMPreviewLib.dll" libraries "directly" rather than referencing native "Windows Media Encoder" COM component through COM tab in add-reference menu. So, there is no chance of setting "Isolated" property to "True" to make COM component registration-free. When you open your project, in solution -> project references, you'll see that you cannot set "Interop.WMEncoder" or "Interop.WMPreview.dll" components as "Isolated", because your project sees referenced assemblies as the ones which were previously converted to interop Dlls via RCW.
 
Maybe that makes some sense.
 
Regards
QuestionHow convert avi-file (sound) to WAV ?memberVysokovskikh Sergey9 Oct '08 - 23:16 
How can I convert avi-file with sound to wav-file? Is it possible with Windows Media Encoder (or other libraries)?
QuestionImgs to movie - Problem when trying to use more then 1 frame per secondmemberRossioli19 Aug '08 - 14:28 
The solution to use WME to create a movie using 1 frame per second oe even 0.5fps, but when I try to change the timer from 1 second to 1/2 second or less in order to have more frames per second, the video created finish with less seconds.
 
For instance:
10 pictures / 1fps = 10 seconds movie
 
20 pictures / 2fps = 8 seconds movie (this should be 10 second, not 8)
 
I think that is WME issue.
 
Do you have any ideas about it?
 
Thanks a lot for this article!
GeneralRe: Imgs to movie - Problem when trying to use more then 1 frame per second [modified]memberRossioli19 Aug '08 - 15:27 
I've just tried to use your sample that has 12 images that creates a 12 seconds video.
 
I've chnaged the Timer.Interval from 1000 to 500.
 
The video created was 5 seconds not 6.
 
But the interesting thing is that if I change to 250, the video turns to 3 seconds, which is the correct size.
 
I still think that the problem is inside the wme instead something that I could change into the app.
 
More images I have or less Timer Interval smaller video I have. Frown | :(
 
modified on Tuesday, August 19, 2008 9:50 PM

QuestionHow to convert AVI and WMV to MPEG/MP4?memberYiping Zou9 Jun '08 - 12:13 
I am working on an application which capturing the video to either AVI or WMV file. But I need convert either of them to either MP4 or MPEG for other application access. I searched around and did not find the way. Is there any way to convert them programmatically?
Thanks
AnswerRe: How to convert AVI and WMV to MPEG/MP4?memberArmoghan Asif10 Jun '08 - 0:48 
Windows Media encouder does not convert from wmv to mp4
 
To do such task i would suggest two ways. The hard way and the easy way.
 
1. Hardway, read the formats and do the converion code yourself
2. Easy way .. search google with somethink like "commandline convert .Avi to mp4"
You will find some freeware or shareware commandline, use it using Process/Shell command to do the conversion
GeneralJoining two videosmemberalarkin7725 May '08 - 2:56 
Hi,
 
In your article you say the join has limitations (same type and size). Is this down to your example or something to do with WMEncoder?
 
I am trying to join an AVI file and a WMV. I have used the sample code provided with the SDK and it looks pretty much the same as yours but it nevers seems to encode the second file!
 
Any ideas?
GeneralRe: Joining two videosmemberArmoghan Asif25 May '08 - 21:52 
It seems to be Encoder limitation.
GeneralHi againmembercircass28 Nov '07 - 13:38 
Do you know a way for converting files to avi format ?
AnswerRe: Hi againmemberArmoghan Asif30 Nov '07 - 1:15 
To my knowledge, Windows media encoder as the name indicates will encode different formats to its format i.e. Wmv and Wma
 
I could not find a way to directly convert it to avi format..
one way is to use some freeware converter to convert wmv to avi.
 
http://www.jakeludington.com/ask_jake/20050911_convert_wmv_to_avi.html
 
and you can google for more

GeneralRe: Hi againmembercircass1 Dec '07 - 3:38 
Are you sure that this basic edit class convert all formats to wmv files ?
Cause i wrote a program that convert and to take a selected part of an avi file but it is only working with wmv files. Your source1.avi is really an avi file ?
İf it is where is my mistake?
 
www.circass.com
www.saricaovaliyiz.biz
GeneralWMEncoder glbEncoder = new WMEncoder();membercircass27 Jun '07 - 22:44 
I take an error message about com object on this line.
I did search about it, is problem about 32bit and 64bit environment ?
Thanx in advice.
GeneralRe: WMEncoder glbEncoder = new WMEncoder();memberArmoghan Asif2 Jul '07 - 20:56 
What kind of error are you getting?
Please explain further
GeneralWMEncoder glbEncoder = new WMEncoder();membercircass2 Jul '07 - 21:55 
WMEncoder glbEncoder = new WMEncoder();
 
Retrieving the COM class factory for component with CLSID {632B606A-BBC6-11D2-A329-006097C4E476} failed due to the following error: 80040154.
 
This is the error message. It gives me that error when i want to start ConvertVideoFileFormats Project. It gives me same error in every project. There is a thing that is not exist in my computer i think.
 
WMEncBasicEdit BasicEdit = new WMEncBasicEdit();
 

Thanx for your help.
GeneralRe: WMEncoder glbEncoder = new WMEncoder();membercircass2 Jul '07 - 22:45 
I found the solution Smile | :) Sorry for my stupidity... After i installed windows media encoder, errors are gone.
 
Thanx.
GeneralRe: WMEncoder glbEncoder = new WMEncoder();memberMudassar Hussain12 Jan '11 - 20:53 
please help me, I am getting same error,
 
try
{
WMEncoder glbEncoder = new WMEncoder();
}
catch
{
//message
}
 
I am getting following exception at above line, Please help me. Thank you
Retrieving the COM class factory for component with CLSID {632B606A-BBC6-11D2-A329-006097C4E476} failed due to the following error: 80040154.
QuestionHow to join videos using vbmemberQasim.Khan20 May '07 - 21:34 
Hi,
 
I want to add/join two avi's through vb code. My expertise are in Java but in VB I know nothing about it. so I need your guidance/help to convert the c# code in VB.
 
I tried to convert the code but I stuck in the on state change method used in EncodeFromConsole. If you plz help me out I shall be very thankful to you.

 
Regards,
Qasim Khan
AnswerRe: How to join videos using vbmemberQasim.Khan21 May '07 - 3:55 
Hi,
 
I am able to convert that code in to the VB and its work fine. If any one needs that code just mail me at my mail id qasemkhan@gmail.com
 
Regards,
 
Qasim Khan
AnswerRe: How to join videos using vbmemberArmoghan Asif23 May '07 - 20:25 
Download SharpDevelop and use it to convert the code to VB.NET.
 
I have tried it and to me it is most accurate one around 80%.

GeneralJoining of videosmemberrahul tanjan23 Apr '07 - 18:27 
Dear Sir,
I tried with the cutting of videos its working fine. but when i try the join them only the first clip will be copied to the output file , not the second source file. Please help me with this. I am using VS2005.
 
zxczc

GeneralRe: Joining of videosmemberArmoghan Asif24 Apr '07 - 21:33 
I have checked the sample using VS2005, it work fine with me..
 
What i did with me is deleted joinedFile.wmv file from bin folder
 
Now two wmv files are present in bin..
source1.avi
source2.avi
 
Ran the project ..
Now joinedFile.wmv is created..
 
It has both the files joined into one file joinedFile.wmv,
source1.avi first and source2.avi after it
 


Generalhelp me in DRMmemberamitmistry_petlad10 Apr '07 - 0:25 
Dear sir,
I have tried your sample,but its not working for vs2005. can you please help me?
and I have also try to run "UncompressAVIToWMV".From samples provide by MS. But its also not working.can you please help me?

 
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India

GeneralNeed help in DRMmemberamitmistry_petlad10 Apr '07 - 0:24 
Dear sir,
I have tried your sample,but its not working for vs2005. can you please help me?
and I have also try to run "UncompressAVIToWMV".From samples provide by MS. But its also not working.can you please help me?
 
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India

GeneralRe: Need help in DRMmemberArmoghan Asif11 Apr '07 - 0:01 
I have not worked on DRM currently ..
I appologize.. i wont be able to help in this regard.
GeneralRe: Need help in DRMmemberamitmistry_petlad11 Apr '07 - 0:06 
But sir , I want to just convert the file avi,mpeg to wmv through window media format sdk9.5/11
nothing more....????
 
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
GeneralRe: Need help in DRMmemberArmoghan Asif13 Apr '07 - 0:03 
>>>window media format sdk9.5/11
 
Have you downloaded window media *format* sdk9.5/11 or Windows Media Encoder ?
 

Download
http://www.microsoft.com/windows/windowsmedia/9series/encoder/default.aspx[Encoder] and http://www.microsoft.com/windows/windowsmedia/9series/encoder/extensible.aspx[SDK]
from these links
 
Such error is not reported by any one else.
GeneralRe: Need help in DRMmemberamitmistry_petlad13 Apr '07 - 0:22 

Armoghan Asif wrote:
http://www.microsoft.com/windows/windowsmedia/9series/encoder/default.aspx[Encoder]

yes,
 
but I want to know the steps of running the code sample for c++.
which is given in the .chm file.
 
Can you please explain me how could i used that thing?
 
C:\Program Files\Windows Media Components\Encoder\Profiles.
 
I havent the above things how can i download that things?
 
and can you please help me for running the console application,
 
its give the error "class not registered".
That means any exe is still remaining for running becoz why it require
the regirstation error at the time of cocreateinstance.
 
what should I installed so that i can get the above path?


 
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India

QuestionCOM Exceptionmembervirus55593 Apr '07 - 17:49 
Dear Sir,
I have tried running the Split File code In Visualstudio 2005.
The building works fine. But while running its gives a COM Exception .
I have even installed the Windows Media Encoder SDK. But Still its not working.
 
with regards
Anil
AnswerRe: COM ExceptionmemberArmoghan Asif10 Apr '07 - 23:54 
i could not reproduce the problem with VS 2005
 
It should work with the sample file..
 
Are you using some other file to do the spliting ?

GeneralRe: COM Exceptionmemberrahul tanjan12 Apr '07 - 22:26 
Thank You Sir,
Now its working Fine Cool | :cool: . First i downloaded the Windows Media Encoder from some site which was fake( only 3.8 MB). After that i downloaded from another site (9.45 MB). But i have got problems with joining of the videos . In the output joined video ,only the first source will be present , not the second source.
 
zxczc

QuestionHow to convert avi file to .movmemberdaydream321119 Jan '07 - 18:17 

Dear sir,
I wrote this question in hope of you can show me how to convert avi file to mov file (Step by step).
I hope that I will receive your answer as soon as possible.
Thank you in advance!
 
Missing You

AnswerRe: How to convert avi file to .movmemberArmoghan Asif24 Jan '07 - 20:41 
I dont think it such conversion is avialable in windows Media encouder.
 
To do such task i would suggest two ways. The hard way and the easy way.
 
1. Hardway, read the formats and do the converion code yourself Smile | :)
2. Easy way .. search google with somethink like "commandline convert .Avi to .Mov"
You will find some freeware or shareware commandline, use it using Process/Shell command to do the conversion
 

QuestionQuestionmemberaktigerlily9 Oct '06 - 20:50 
The reason I am attempting to download this program is that all my mpeg files are playing upside down and I can't figure out why so I want to convert them to Windows Media Files. I downloaded the ConvertSingleFile, but I'm not sure what to do from there. Is there anything site I can go to that may help me in this process? Thank you for any help you can give.
AnswerRe: QuestionmemberArmoghan Asif10 Oct '06 - 23:24 
I would suggest google "Rotate an AVI" or "Rotate a movie"
and find some software..
 
The following code is not for this purpose
QuestionWhat if source has no audiomemberArie-Kanarie28 Sep '06 - 2:19 
Does anyone know how I can check if a source video file has audio?
I want to use WM Encoder to convert some files to .wmv but I don't always know if the source video has an audio stream.
 
If you try to convert a videofile with no audio stream, with a profile that has audio (ContentType = 17) you'll get an error.
 
I've tried:
if (SrcAud.Duration > 0)
but then I get the error:
0xC00D002B (request invalid in current state)
 
Does anyone know the solution, or where I can find the solution?
 

AnswerWhat if source has no audiomembercircass2 Jul '07 - 22:08 
You can use
TRY
{
Your code you want to use.
}
 
CATCH ()
{
Nothing here.
}
 
Thats enough for solution.

QuestionHelp :(membertomsmaily12324 Sep '06 - 9:34 
Can u show me a way to stream video from network/file?.The problem is the source file is encrypted and i can't decrypt it at once coz of security. Pls show me some code to stream the decrypted chunks(from a buffer where 5-10MB is decrypted and stored).
Now i can give a file path to media player componnent to play, as u can see it is not suitable here
Pls help providing some codes Confused | :confused:
Thnx in advance
Tom
AnswerRe: Help :(memberArmoghan Asif24 Sep '06 - 18:30 
I didnt quite understand the problem..
 
I think you should use SSL which will make the transport layer secure.
 

The two ways to play/encode from another machine using stream are. 1) File (Mapped Drive).. 2) HTTP
 
For more details find "Working with Sources and Source Groups"
In SDK help and see if it helps you

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 30 May 2005
Article Copyright 2004 by Armoghan Asif
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid