我注意到Exression 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));发布于 2011-03-16 01:15:56
不确定,关于解决问题的方法,但想给你一些关于音频问题的输入。在这两台机器上,我测试了我的应用程序、屏幕截图以及音频的完美工作。因此,我只能得出结论,它可能与您的硬件有关,或者您的代码有问题……(也许可以通过它进行调试?)
此外,您的解决方案可能与this.相同
https://stackoverflow.com/questions/5224602
复制相似问题