472,995 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,995 software developers and data experts.

Help with Media Encoder 9, examples don't compile


I'm trying to simply convert a .avi file recorded by our program to a
wmv file, of course compressed as possible.

I've looked at the examples provided by microsoft @
http://msdn.microsoft.com/library/de...deexamples.asp
in both CSharp and VB6. I can't get them to compile. Some of the
objects listed (namely the IWMEncVideoSource2 object in CSharp and
IWMEncAudioSource and IWMEncSourceGroup2 objects in VB6) don't exist
in the library.

I'm guessing this is because I don't have the right library or
something, but I have the Windows Media Encoder 9 SDK installed and
the reference set to Windows Media Encoder in both projects
(VB6/Csharp).

If these really don't work with Encoder 9, can someone offer an
example how to use the encoder then? I just something quick, not
setting a lot of options, not doing anything special, just trying to
save space by compressing the .avi files with the encoder.

Thanks much for whatever help you can offer.
Nov 13 '05 #1
3 11535

"Matt" <no@no.com> wrote in message
news:k5********************************@4ax.com...

I'm trying to simply convert a .avi file recorded by our program to a wmv file, of course compressed as possible.

I've looked at the examples provided by microsoft @
http://msdn.microsoft.com/library/de...deexamples.asp in both CSharp and VB6. I can't get them to compile. Some of the objects listed (namely the IWMEncVideoSource2 object in CSharp and IWMEncAudioSource and IWMEncSourceGroup2 objects in VB6) don't exist in the library.

I'm guessing this is because I don't have the right library or something, but I have the Windows Media Encoder 9 SDK installed and the reference set to Windows Media Encoder in both projects
(VB6/Csharp).

If these really don't work with Encoder 9, can someone offer an example how to use the encoder then? I just something quick, not setting a lot of options, not doing anything special, just trying to save space by compressing the .avi files with the encoder.


Have you checked "Windows Media Encoder" in Project >
References... ? It has the types for IWMEncVideoSource and
WMEncSourceGroup -- perhaps those are adequate?
Nov 13 '05 #2
On Fri, 11 Jul 2003 11:26:04 -0500, "Grinder"
<gr*****@no.spam.maam.com> wrote:

I thought about that...and while the SourceGroup gave no errors, the
audio didn't work with the video object.
Have you checked "Windows Media Encoder" in Project >
References... ? It has the types for IWMEncVideoSource and
WMEncSourceGroup -- perhaps those are adequate?


Nov 13 '05 #3
This is the source I have, direct from microsoft. I have WMEncoderLib
as a reference.

This source fails to compile with a
C:\mine\code\C#\Encoder\Class1.cs(29): The type or namespace name
'IWMEncVideoSource2' could not be found (are you missing a using
directive or an assembly reference?)
error @ this part of the code:
"IWMEncVideoSource2 SrcVid ="

Thanks for help you can offer

-Matt

CODE:
using System;
using WMEncoderLib;

namespace Matt
{
/// <summary>
/// Summary description for Class1.
/// </summary>

class EncodeFile
{
static void Main()
{
try
{
// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();

// Retrieve the source group
collection.
IWMEncSourceGroupCollection SrcGrpColl
= Encoder.SourceGroupCollection;

// Add a source group to the
collection.
IWMEncSourceGroup SrcGrp =
SrcGrpColl.Add("SG_1");

// Add a video and audio source to the
source group.
IWMEncSource SrcAud =
SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcAud.SetInput("C:\\Inputfile.mpg",
"", "");

IWMEncVideoSource2 SrcVid =
(IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_ TYPE.WMENC_VIDEO);
SrcVid.SetInput("C:\\Inputfile.mpg",
"", "");

// Crop 2 pixels from each edge of the
video image.
SrcVid.CroppingBottomMargin = 2;
SrcVid.CroppingTopMargin = 2;
SrcVid.CroppingLeftMargin = 2;
SrcVid.CroppingRightMargin = 2;

// Specify a file object in which to
save encoded content.
IWMEncFile File = Encoder.File;
File.LocalFileName =
"C:\\OutputFile.wmv";

// Choose a profile from the
collection.
IWMEncProfileCollection ProColl =
Encoder.ProfileCollection;
IWMEncProfile Pro;
for (int i = 0; i < ProColl.Count;
i++)
{
Pro = ProColl.Item(i);
if (Pro.Name == "Windows Media
Video 8 for Local Area Network (384 Kbps)")
{

SrcGrp.set_Profile(Pro);
break;
}
}

// Fill in the description object
members.
IWMEncDisplayInfo Descr =
Encoder.DisplayInfo;
Descr.Author = "Author name";
Descr.Copyright = "Copyright
information";
Descr.Description = "Text description
of encoded content";
Descr.Rating = "Rating information";
Descr.Title = "Title of encoded
content";

// Add an attribute to the collection.
IWMEncAttributes Attr =
Encoder.Attributes;
Attr.Add ("URL", "IP address");

// Start the encoding process.
// Wait until the encoding process
stops before exiting the application.
Encoder.PrepareToEncode(true);
Encoder.Start();
Console.WriteLine("Press Enter when
the file has been encoded.");
Console.ReadLine(); // Press Enter
after the file has been encoded.
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
}
}
}
On Tue, 15 Jul 2003 07:32:44 GMT, yh*****@online.microsoft.com
(Yan-Hong Huang[MSFT]) wrote:
Hello Matt,

Please refer to
http://msdn.microsoft.com/library/en...ngincsharp.asp
?frame=true to double check that you have added all the references.

Also, please add using WMEncoderLib; in the code. Please refer to
http://msdn.microsoft.com/library/en...deosource2prep
rocesspass.asp?frame=true for code samples.

Hope it helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mini | last post by:
Who has experience with setting up a php-site with live video from DV-camera's ?
3
by: priya | last post by:
Hi, I want to convert an .mpeg to a .wmv file. //Creating an Encoder object WMEncoder Encoder = new WMEncoder(); //Create a Source Collection Group IWMEncSourceGroupCollection SrcGrpColl =...
0
by: Aaron Oxford | last post by:
Recently I tried installing the Windows Media Encoder SDK 9.5. Big mistake :-(, it's only got C++ support at this time and seems to have caused me a problem with my code, as well as refusing to...
0
by: Mamatha | last post by:
Hi I am developing one video capturing application,in that application i want to display a window exactly like what the Windows Media Encoder Properties button will do. Please give me any...
0
by: Mamatha | last post by:
Hi I am developing video capturing application in C#.NET,in that application i want to display Windows Media Encoder Session properties window(If we click on properties button of Windows Media...
0
by: Mamatha | last post by:
Hi I am developing small application in C#.NET,In that application when i click on one button,i want to display Windows Media Encoder Session Properties window. I searched in Google,and i got...
0
by: Crisco www.misericordia.com.br | last post by:
Hi, friends! I am develop a simple encoder app, one form with one button that start the encoder. This is my code: ============================================================= Option...
0
by: ata | last post by:
Greetings! I am using Windows Media Encoder SDK in order to create broadcast from different sources for example webcam,microphone and etc. I want to create broadcast from file. And here is my...
0
by: sunny152 | last post by:
Hello Friends, I'm very interested to broadcast our church worship service live on internet.My web server having streaming feature and i have windows media encoder program.I usually...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.