0

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

1 回答 1

0

不确定,关于解决问题的方法,但想给你一些关于音频问题的意见。在这几台机器上,我测试了我的应用程序,屏幕截图和音频都运行良好。因此,我只能得出结论,这可能与您的硬件或代码问题有关......(也许通过它进行调试?)

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

于 2011-03-15T17:15:56.183 回答