#181365 - 2007-10-09 12:22 PM
Windows Media Encoder SDK
|
RXR
Lurker
Registered: 2007-04-23
Posts: 4
|
I try to automate an Encoding Session of a Windows Media Encoder server. Some functions are just working fine, but some are giving kixtart errors, like the following.
001 $Encoder = CreateObject("WMEncEng.WMEncoder") 002 $pBroadccast=$Encoder.broadcast 003 $p1=”\\servername\share\MyPubPoint.nsc” 004 $p2=”\\MyComputer\MyPubPoint.asx” 005 ? vartype($Encoder) 006 ? vartype($pBroadccast) 007 $pBroadcast.GenerateAnnoucementFile($p1, $p2) Executing lignes 005 and 006 gives 9 When executing line 007, I get the following message :
ERROR : expected ‘)’ !
To write these lines, I took as a starting point the following Visual Basic source coming from the Media Encoder SDK.
= = = START SOURCE = = =
' Declare variables.
Dim Encoder As WMEncoder
Dim SrcGrpColl As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup2
Dim SrcAud As IWMEncAudioSource
Dim SrcVid As IWMEncVideoSource
Dim ProColl As IWMEncProfileCollection
Dim Pro As IWMEncProfile
Dim PushDist As IWMEncPushDistribution
Dim strServerName As String
Dim strPubPoint As String
Dim strPubTemplate As String
Dim MyNSCFile As String
Dim MyNSCURL As String
Dim MyASXFile As String
Private Sub Main()
' Create a WMEncoder object.
Set Encoder = New WMEncoder
' Retrieve the source group collection and add sources.
' Use the default devices for the audio and video sources.
Set SrcGrpColl = Encoder.SourceGroupCollection
Set SrcGrp = SrcGrpColl.Add("SG_1")
Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
SrcAud.SetInput ("device://default_audio_device")
SrcVid.SetInput ("device://default_video_device")
' Retrieve the profile collection. This example uses the 3rd profile.
Set ProColl = Encoder.ProfileCollection
Set Pro = ProColl.Item(2)
SrcGrp.Profile = Pro
' Set up the push broadcast.
Set PushDist = Encoder.Broadcast
' Specify the push distribution variables, including the Windows Media
' server name, publishing point, and announcement files.
' Provide real values for the following placeholders.
strServerName = "MyWMServer:70"
strPubPoint = "MyPubPoint"
strPubTemplate = "AnotherPubPoint"
MyNSCFile = "\\servername\share\MyPubPoint.nsc"
MyNSCURL = "\\servername\share\MyPubPoint.nsc"
MyASXFile = "\\MyComputer\MyPubPoint.asx"
' Remove the publishing point when the broadcast is over.
PushDist.AutoRemovePublishingPoint = True
' Set the push distribution variables.
PushDist.ServerName = strServerName
PushDist.PublishingPoint = strPubPoint
PushDist.Template = strPubTemplate
Encoder.PrepareToEncode True
' Generate the announcement file.
PushDist.GenerateMulticastInfoFile (MyNSCFile)
PushDist.GenerateAnnouncementFile MyNSCURL, MyASXFile
' Start encoding.
Encoder.Start
MsgBox "Click OK to stop broadcasting."
End Sub
= = = END SOURCE = = =
Is somebody able to give me an explanation why the call to the function GenerateAnnoucementFile is not working.
Thanks a lot for your collaboration.
Ralph
|
|
Top
|
|
|
|
#181383 - 2007-10-09 04:18 PM
Re: Windows Media Encoder SDK
[Re: Witto]
|
RXR
Lurker
Registered: 2007-04-23
Posts: 4
|
Thanks for your answer.
I looked with an ActiveX/COM pgm inspector and the result is the following : void GenerateAnnouncementFile(BSTR bstrNSCURL, BSTR bstrASXFileName). Like you can see, the function is requesting two parameters. So, the solution must be elsewhere I guess.
|
|
Top
|
|
|
|
#181397 - 2007-10-09 07:23 PM
Re: Windows Media Encoder SDK
[Re: RXR]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Can you add some error checks?$Encoder = CreateObject("WMEnc.WMEncoder")
"Error: " @error ": " @SERROR ?
$pBroadccast=$Encoder.broadcast
"Error: " @error ": " @SERROR ? If you downloaded and installed the Windows Media Encoder 9 Series, I think you need to writeBreak On
Dim $Encoder
$Encoder = CreateObject("WMEnc.WMEncoderapp")
Edited by Witto (2007-10-10 08:42 AM)
|
|
Top
|
|
|
|
#181425 - 2007-10-10 01:40 PM
Re: Windows Media Encoder SDK
[Re: Witto]
|
RXR
Lurker
Registered: 2007-04-23
Posts: 4
|
If I execute de line $pBroadcast.GenerateAnnoucementFile($p1) I get the error -2147352570 Unknown name.
You are right, there is a problem invoking the function. Is there a way of carrying out this function. I double checked with an ActiveX/COM analyer, I can see it, may be kixtart is not able to handle this type of function ? or I'm not invoking the function in a rigth way ?
What do you think about it?
|
|
Top
|
|
|
|
#181444 - 2007-10-10 04:51 PM
Re: Windows Media Encoder SDK
[Re: RXR]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
What does this give you:
$Encoder = CreateObject("WMEnc.WMEncoder")
"Error: " @error ": " @SERROR ?
Reason: see my previous post if you installed the "Windows Media Encoder 9 Series", I think you should write:
$Encoder = CreateObject("WMEnc.WMEncoderapp")
|
|
Top
|
|
|
|
#181445 - 2007-10-10 05:49 PM
Re: Windows Media Encoder SDK
[Re: Witto]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
translated the whole deal for you, watch the comments:
Main()
;= = = START SOURCE = = =
; Declare variables.
Dim $Encoder
Dim $SrcGrpColl
Dim $SrcGrp
Dim $SrcAud
Dim $SrcVid
Dim $ProColl
Dim $Pro
Dim $PushDist
Dim $strServerName
Dim $strPubPoint
Dim $strPubTemplate
Dim $MyNSCFile
Dim $MyNSCURL
Dim $MyASXFile
Function Main()
; Create a WMEncoder object.
$Encoder = CreateObject("WMEncEng.WMEncoder")
; Retrieve the source group collection and add sources.
; Use the default devices for the audio and video sources.
$SrcGrpColl = $Encoder.SourceGroupCollection
$SrcGrp = $SrcGrpColl.Add("SG_1")
$SrcAud = $SrcGrp.AddSource(WMENC_AUDIO)
$SrcVid = $SrcGrp.AddSource(WMENC_VIDEO)
$SrcAud.SetInput("device://default_audio_device")
$SrcVid.SetInput("device://default_video_device")
;You have to figure out what value WMEX_AUDIO and WMENC_VIDEO are and changes those
; Retrieve the profile collection. This example uses the 3rd profile.
$ProColl = $Encoder.ProfileCollection
$Pro = $ProColl.Item(2)
$SrcGrp.Profile = $Pro
; Set up the push broadcast.
$PushDist = $Encoder.Broadcast
; Specify the push distribution variables, including the Windows Media
; server name, publishing point, and announcement files.
; Provide real values for the following placeholders.
$strServerName = "MyWMServer:70"
$strPubPoint = "MyPubPoint"
$strPubTemplate = "AnotherPubPoint"
$MyNSCFile = "\\servername\share\MyPubPoint.nsc"
$MyNSCURL = "\\servername\share\MyPubPoint.nsc"
$MyASXFile = "\\MyComputer\MyPubPoint.asx"
; Remove the publishing point when the broadcast is over.
$PushDist.AutoRemovePublishingPoint = 1
; Set the push distribution variables.
$PushDist.ServerName = $strServerName
$PushDist.PublishingPoint = $strPubPoint
$PushDist.Template = $strPubTemplate
$Encoder.PrepareToEncode(1)
; Generate the announcement file.
$PushDist.GenerateMulticastInfoFile($MyNSCFile)
$PushDist.GenerateAnnouncementFile($MyNSCURL, $MyASXFile)
; Start encoding.
$Encoder.Start
$=MessageBox("Click OK to stop broadcasting.","")
EndFunction
;= = = END SOURCE = = =
Not sure wether it'll work though but basically this is translated correctly
|
|
Top
|
|
|
|
#181494 - 2007-10-11 11:21 AM
Re: Windows Media Encoder SDK
[Re: Arend_]
|
RXR
Lurker
Registered: 2007-04-23
Posts: 4
|
If I carry out the entire script as you translated it it works !!! So, I suppose that I have to execute some functions before making others available !!
Anyway, thanks a lot for your help guys.
|
|
Top
|
|
|
|
#181496 - 2007-10-11 11:29 AM
Re: Windows Media Encoder SDK
[Re: RXR]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
No Problem, glad we could help
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|