public bool StartRecording() { VideoStreamerRecordingPreset preset = VideoStreamerRecordingPreset.Source; if (String.IsNullOrWhiteSpace(_recordingConfig.Preset) == false) { preset = VideoStreamerRecordingPreset.Presets.FirstOrDefault(p => p.Name == _recordingConfig.Preset) ?? preset; } string codecArgs = _config.FFmpegCodecArgs .Replace("{resolutionScale}", preset.ResolutionScale) .Replace("{bitrate}", preset.Bitrate.ToString()) .Replace("{framerate}", preset.FrameRate.ToString()); string targetPath = Path.ChangeExtension(_recordingConfig.TargetPath, _config.Extension); bool started = _streamer.StartRecordingProcess(FFmpegStreamType.VIDEO, _selectedDevice, targetPath, codecArgs); if (started) { RecordingStarted?.Invoke(this, EventArgs.Empty); } return(started); }
public bool StartRecording() { if (String.IsNullOrWhiteSpace(_selectedDevice) == false && _streamer.IsRunning == false) { Log?.Invoke(this, new Core.LogMessage(Core.LogLevel.Info, LogTags.Recording, "Starting recording...")); string codecArgs = _config.FFmpegCodecArgs .Replace("{bitrate}", _recordingConfig.Bitrate.ToString()); string targetPath = Path.ChangeExtension(_recordingConfig.TargetPath, _config.Extension); bool started = _streamer.StartRecordingProcess(FFmpegStreamType.AUDIO, _selectedDevice, targetPath, codecArgs); if (started) { RecordingStarted?.Invoke(this, EventArgs.Empty); Log?.Invoke(this, new Core.LogMessage(Core.LogLevel.Info, LogTags.Recording, "Recording started")); } return(started); } return(false); }