C# 微软表达式编码器。捕捉

C# 微软表达式编码器。捕捉,c#,expression-encoder,expression-encoder-sdk,C#,Expression Encoder,Expression Encoder Sdk,我注意到Expression Encoder 4屏幕录制有时比指定的短。例如,5分钟的录音只能产生15秒的视频。这似乎与视频同时捕获的音频有关。最初,我使用耳机扬声器作为音频配置文件。当我从录音中删除字幕音频时,问题就停止了。当我将音频配置文件更改为标准扬声器时,它也停止了。然而,当录音开始时,通过快速改变音量,我可以很容易地重现它。结果是录音被冻结了。。。记录仍然需要5分钟;但结果只有15秒左右的视频 代码片段如下所示 try { _sc

我注意到Expression Encoder 4屏幕录制有时比指定的短。例如,5分钟的录音只能产生15秒的视频。这似乎与视频同时捕获的音频有关。最初,我使用耳机扬声器作为音频配置文件。当我从录音中删除字幕音频时,问题就停止了。当我将音频配置文件更改为标准扬声器时,它也停止了。然而,当录音开始时,通过快速改变音量,我可以很容易地重现它。结果是录音被冻结了。。。记录仍然需要5分钟;但结果只有15秒左右的视频

代码片段如下所示

        try
        {
            _screenCaptureJob = new ScreenCaptureJob();
            _screenCaptureJob.CaptureRectangle = _screenRectangle;
            _screenCaptureJob.ShowFlashingBoundary = true;
            _screenCaptureJob.ScreenCaptureVideoProfile.FrameRate = 20;
            _screenCaptureJob.CaptureMouseCursor = false;

            _screenCaptureJob.ScreenCaptureCommandFinished += new EventHandler<ScreenCaptureCommandFinishedEventArgs>(_screenCaptureJob_ScreenCaptureCommandFinished);
            _screenCaptureJob.ScreenCaptureFinished += new EventHandler<ScreenCaptureEventArgs>(_screenCaptureJob_ScreenCaptureFinished);

            Collection<EncoderDevice> audioDevices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);
            try
            {
                EncoderDevice foundDevice = audioDevices.First(delegate(EncoderDevice item) { return item.Name.StartsWith(@"Speakers"); });
                _screenCaptureJob.AddAudioDeviceSource(foundDevice);
            }
            catch (Exception ex)
            {
                _appLogger.Error(string.Format("RecordNextSegment. Cannot find prefered audio device using {0} !", audioDevices[0].Name), ex);
                _screenCaptureJob.AddAudioDeviceSource(audioDevices[0]);
            }
            _currentDurationInSeconds = (_recordDurationInSeconds < _maxSegmentDurationInSeconds) ? _recordDurationInSeconds : _maxSegmentDurationInSeconds;

            _screenCaptureJob.Duration = DateTimeUtilities.DurationToTimeSpan(_currentDurationInSeconds);
            _screenCaptureJob.OutputScreenCaptureFileName = string.Format(@"{0}\{1}.wmv", _tvaConfiguration.TVAVideoDirectoryRawVideo, FileNameFromSegment(_segmentNumber ));
             _screenCaptureJob.Start();
            LogInfo(string.Format("Remaining time (seconds): {0}. Current time: {1}. File: {2}", _recordDurationInSeconds, _currentDurationInSeconds, _screenCaptureJob.OutputScreenCaptureFileName));
试试看
{
_screenCaptureJob=新建screenCaptureJob();
_screenCaptureJob.CaptureRectangle=\u screenRectangle;
_screenCaptureJob.ShowFlashingBoundary=true;
_screenCaptureJob.ScreenCaptureVideoProfile.FrameRate=20;
_screenCaptureJob.CaptureMouseCursors=false;
_screenCaptureJob.ScreenCaptureCommandFinished+=新事件处理程序(\u screenCaptureJob\u ScreenCaptureCommandFinished);
_screenCaptureJob.ScreenCaptureFinished+=新事件处理程序(\u screenCaptureJob\u ScreenCaptureFinished);
采集音频设备=EncoderDevices.FindDevices(EncoderDeviceType.Audio);
尝试
{
EncoderDevice foundDevice=audioDevices.First(委托(EncoderDevice项){return item.Name.StartsWith(@“Speakers”);});
_screenCaptureJob.AddAudioDeviceSource(foundDevice);
}
捕获(例外情况除外)
{
_appLogger.Error(string.Format(“RecordNextSegment.not-find preferred audio devices using{0}!”,audioDevices[0].Name),ex);
_screenCaptureJob.AddAudioDeviceSource(audioDevices[0]);
}
_currentDurationInSeconds=(\u recordDurationInSeconds<\u maxSegmentDurationInSeconds)?\u recordDurationInSeconds:\u maxSegmentDurationInSeconds;
_screenCaptureJob.Duration=DateTimeUtilities.DurationToTimeSpan(\u currentDurationInSeconds);
_screenCaptureJob.OutputScreenCaptureFileName=string.Format(@“{0}\{1}.wmv”,_-tvaConfiguration.tvavideDirectoryRawVideo,FileNameFromSegment(_-segmentNumber));
_screenCaptureJob.Start();
LogInfo(string.Format(“剩余时间(秒):{0}。当前时间:{1}。文件:{2}”,_recordDurationInSeconds,_currentDurationInSeconds,_screenCaptureJob.OutputScreenCaptureFileName));

不确定如何解决您的问题,但想为您提供一些关于音频问题的信息。在这两台机器上,我测试了我的应用程序,屏幕截图以及音频工作正常。因此,我只能得出结论,这可能与您的硬件有关,或者与您的代码有关。。。(可能调试通过它?)

此外,您的解决方案可能与相同