我注意到 Exression 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));