表达式编码器4:作为Windows服务运行时,表达式编码器的内存不足异常 [英] Expression Encoder 4 : Out Of Memory Exceptions with Expression Encoder when running as a Windows Service
问题描述
您好,
我一直遇到来自SDK的Expression Encoder 4引擎的问题,包含在Windows服务中,用于服务器上的后处理文件。我收到错误/崩溃时包含错误/异常消息。
I've been experiencing a problem with the Expression Encoder 4 engine from the SDK, as wrapped into in a Windows Service for post processing files on a server. I'm getting errors / crashes with the error/exception messages included bellow.
My Source基于AVISYNTH文件(AVS),它们提供2个WMV文件并创建PIP合成图像。
My Source is based on AVISYNTH files (AVS), which are sourcing 2 WMV files and creating a PIP composite image.
现在有趣的部分是,如果我在Expression Encoder 4 GUI中运行这些文件,我没有问题,编码能够处理。我实际上在两种情况下使用相同的编码配置文件,以确保它不是
问题。
Now the interesting part is that if I run these files within the Expression Encoder 4 GUI, I don't have the problem, and the encoding are capable of processing through. I'm actually using the same Encoding profile in both cases, as to make sure it's not an issue there.
处理器数量明显存在显着差异/应用程序在作为服务运行或作为基于交互式GUI的应用程序运行时可以访问的内存。 有关如何最好地解决此问题的任何建议吗? 我假设这个
有关于EncoderEngine请求的Treading的事情,我只是从SDK示例中实例化了。任何关于如何解决这个问题的建议都会受到衷心的感谢,因为我的编码器需要在后台作为Windows服务运行,并且
实际上可以同时运行多个实例。
There is definitively a noticeable difference in the amount of processor / memory the application can access when running as a service or as an interactive GUI based application. Any suggestions on how to best address this ? I'm assuming this has something to do w/ the Treading of the EncoderEngine request, which I simply instantiated from SDK samples. Any suggestion on how to address this would be sincerely appreciated, since my encoder needs to run in the background as a Windows Service and should actually be able to run multiple instances at the same time.
我知道IIS转换管理器使用Expression Encoder 4引擎,并且没有机会在那里尝试我的AVS文件,但是该团队中的某个人可以建议在服务中使用它的最佳方式吗?这次我不能以
的价格转移到IIS转换管理器,因为我们的后端处理会处理更多类型的处理类型作业,但是编译引擎/线程/作业的创建和调用方式可能会有所改变。让它在Windows服务中运行时没有这些崩溃。
I know the IIS Transform Manager uses the Expression Encoder 4 engine, and have not had a chance to try my AVS files there, but maybe someone from that team can suggest best way to use it as wrapped in a service ? I can't move to IIS Transform Manager at this time since our back end processing does quite a bit more processing types jobs, but maybe there is something in the way the encoder engine / thread / job is created and called which lets it run without these crashs when in a Windows Service.
包括下面是请求编码文件的示例代码和EncodeThreadCall
Included bellow is the sample code requesting the encoding of the file and the EncodeThreadCall
  ;
编辑包含发布错误的README语境
EDIT TO INCLUDE CONTEXT from README on posting bugs
A. Version
和Expression Encoder的SKU: Expression Encoder 4 Pro
A. Version and SKU of Expression Encoder: Expression Encoder 4 Pro
B. OS
使用的是32或64位: 2008 Server R2,64bit
B. OS used and whether it's 32 or 64bit: 2008 Server R2, 64bit
C. 如果
使用设备,驱动程序的型号和版本.none / file
D. if if
使用源文件,文件类型以及视频和音频编解码器。文件AVS(avisyth),通过Directshow采购WMV
D. If using a source file, file type and video and audio codecs. File AVS (avisyth), sourcing WMV through Directshow
E. 如果
第三方编解码器用于处理此来源,每个编码解码器的名称和版本。
AVISYNTH,2.58 ,使用DirectShowSource.dll, 2.5.8.6,Avisynth DirectShow Reader插件
E. If
3rd party codecs are used to deal with this source, the name and version of each of them.
AVISYNTH, 2.58, using DirectShowSource.dll, 2.5.8.6, Avisynth DirectShow Reader pluggin
F. 如果
需要特定的编码设置,作业或预设。标准WMV9,WMA配置文件,源宽度/高度
F. If specific encode settings are required, the job or the preset. Standard WMV9, WMA profile, Source Width/Height
Public Sub EncodeFile(ByVal pInputFile As String, ByVal pOutputFile As String, Optional ByVal pProfile As String = "DEFAULT")
Me.InputFileName = pInputFile
Me.profileUsedToEncode = pProfile
Me.OutputFileName = pOutputFile
' Create a thread to do the encode.
Me.encodeThread = New Threading.Thread(New Threading.ThreadStart(AddressOf EncodeThreadCall))
Me.encodeThread.Start()
End Sub
Private Sub EncodeThreadCall()
Try
' Create the media item.
Dim mediaItem As MediaItem
Try
mediaItem = New MediaItem(Me.InputFileName)
Catch exp As InvalidMediaFileException
'IndicateEncodingIsFinished(exp.Message)
RaiseEvent EncoderError(Me, exp.ToString)
Return
End Try
mediaItem.OutputFormat = New WindowsMediaOutputFormat()
If profileUsedToEncode = String.Empty Then
Dim preset As Preset = preset.FromFile("default.PRX.xml")
mediaItem.ApplyPreset(preset)
Else
Dim preset As Preset = preset.FromFile(profileUsedToEncode)
mediaItem.ApplyPreset(preset)
End If
' Create the job, add the media item and encode.
Using job As New Job()
If System.IO.Path.IsPathRooted(OutputFileName) Then
mediaItem.OutputFileName = System.IO.Path.GetFileName(OutputFileName)
job.OutputDirectory = System.IO.Path.GetDirectoryName(OutputFileName)
Else
mediaItem.OutputFileName = OutputFileName
End If
job.MediaItems.Add(mediaItem)
job.JobId = Guid.NewGuid().ToString()
job.CreateSubfolder = False
AddHandler job.EncodeProgress, AddressOf handler_EncodeProgress
AddHandler job.EncodeCompleted, AddressOf handler_EncodeCompleted
job.Encode()
End Using
Catch ex As Exception
RaiseEvent EncoderError(Me, ex.ToString)
End Try
End Sub
推荐答案
可能是你的SDK应用程序刚刚耗尽记忆默认情况下,SDK应用程序只能访问2GB内存,而UI可以访问3GB,因为我们设置了大地址识别标志。您可以尝试使用EDITBIN
在SDK应用上设置此标记,看看是否有帮助。有关该标志的更多详细信息,请参阅以下链接。
It could be that your SDK app is just running out of memory. By default an SDK app just has access to 2GB of memory whereas the UI will have access to 3GB as we set the large address aware flag. You could try setting this flag on your SDK app by using EDITBIN and see if that helps. See the following link for more details on the flag.
http://msdn.microsoft.com/en-us/library/203797te.aspx
问候
这篇关于表达式编码器4:作为Windows服务运行时,表达式编码器的内存不足异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!