private async void OnStartRecording(object sender, RoutedEventArgs e) { cameraCapture.setTargetFile(new File(KnownFolders.VideosLibrary, captureOutput)); var winRtVideoFormat = new WinRtVideoFormat("video/avc", 640, 480) { bitrate = 1000000 }; winRtVideoFormat.frameRate.Numerator = 30; winRtVideoFormat.frameRate.Denominator = 1; cameraCapture.setTargetVideoFormat(winRtVideoFormat); cameraCapture.setTargetAudioFormat(new WinRtAudioFormat("audio/aac") { sampleRate = 44100, bitrate = 128000, bitsPerSample = 16, channelCount = 2 }); await cameraCapture.start(); UpdateUiState(PageState.InProgress); }
private void SetTranscodeParameters() { IVideoFormat videoFormat = Preview.VideoFormat; IAudioFormat audioFormat = Preview.AudioFormat; mediaComposer.addSourceFile(new File(Preview.File)); IMediaFile mediaFile = mediaComposer.getSourceFiles()[0]; var sourceFiles = mediaComposer.getSourceFiles(); if (sourceFiles.Count != 0) { double mul = Preview.Duration / 100; long trimStartTime = (long)(Preview.SegmentStart * mul); long trimStopTime = (long)(Preview.SegmentEnd * mul); var sourceFile = sourceFiles[0]; sourceFile.addSegment(Segment.fromMicroSeconds(trimStartTime, trimStopTime)); } ComboBoxItem framerateItem = (ComboBoxItem)FramerateSelect.SelectedItem; String videoProfile = ((ComboBoxItem)ProfileSelect.SelectedItem).Content.ToString(); var match = Regex.Match(videoProfile, @"\(([0-9]+)x([0-9]+)\)"); uint width = uint.Parse(match.Groups[1].Value); uint height = uint.Parse(match.Groups[2].Value); uint framerate = uint.Parse(framerateItem.Content.ToString()); uint bitrate = (uint)(BitrateSelect.Value * 1000); if (videoFormat != null) { var vFormat = new WinRtVideoFormat(videoMimeType, width, height) { bitrate = bitrate }; vFormat.frameRate.Numerator = framerate; vFormat.frameRate.Denominator = 1; mediaComposer.setTargetVideoFormat(vFormat); } if (audioFormat != null) { var aFormat = new WinRtAudioFormat(audioMimeType) { bitrate = audioFormat.bitrate, bitsPerSample = audioFormat.bitsPerSample, channelCount = audioFormat.channelCount, sampleRate = audioFormat.sampleRate }; mediaComposer.setTargetAudioFormat(aFormat); } }
private void SetTranscodeParameters() { IVideoFormat videoFormat = Preview.VideoFormat; IAudioFormat audioFormat = Preview.AudioFormat; mediaComposer.addSourceFile(new File(Preview.File)); ComboBoxItem framerateItem = (ComboBoxItem)FramerateSelect.SelectedItem; String videoProfile = ((ComboBoxItem)ProfileSelect.SelectedItem).Content.ToString(); var match = Regex.Match(videoProfile, @"\(([0-9]+)x([0-9]+)\)"); uint width = uint.Parse(match.Groups[1].Value); uint height = uint.Parse(match.Groups[2].Value); uint framerate = uint.Parse(framerateItem.Content.ToString()); uint bitrate = (uint)(BitrateSelect.Value * 1000); if (videoFormat != null) { var vFormat = new WinRtVideoFormat(videoMimeType, width, height) { bitrate = bitrate }; vFormat.frameRate.Numerator = framerate; vFormat.frameRate.Denominator = 1; mediaComposer.setTargetVideoFormat(vFormat); } if (audioFormat != null) { var aFormat = new WinRtAudioFormat(audioMimeType) { bitrate = audioFormat.bitrate, bitsPerSample = audioFormat.bitsPerSample, channelCount = audioFormat.channelCount, sampleRate = audioFormat.sampleRate }; mediaComposer.setTargetAudioFormat(aFormat); } for (int i = 0; i < EffectsMenu.Items.Count; ++i) { ToggleMenuFlyoutItem item = (ToggleMenuFlyoutItem)EffectsMenu.Items[i]; if (item.IsChecked) { mediaComposer.addVideoEffect(SamplesUtils.GetVideoEffectByName(item.Text)); } } }
protected void SetTranscodeParameters() { IVideoFormat videoFormat = Preview.VideoFormat; IAudioFormat audioFormat = Preview.AudioFormat; mediaComposer.addSourceFile(new File(Preview.File)); mediaComposer.addSourceFile(new File(Preview2.File)); ComboBoxItem framerateItem = (ComboBoxItem)FramerateSelect.SelectedItem; String videoProfile = ((ComboBoxItem)ProfileSelect.SelectedItem).Content.ToString(); var match = Regex.Match(videoProfile, @"\(([0-9]+)x([0-9]+)\)"); uint width = uint.Parse(match.Groups[1].Value); uint height = uint.Parse(match.Groups[2].Value); uint framerate = uint.Parse(framerateItem.Content.ToString()); uint bitrate = (uint)(BitrateSelect.Value * 1000); if (videoFormat != null) { var vFormat = new WinRtVideoFormat(videoMimeType, width, height) { bitrate = bitrate }; vFormat.frameRate.Numerator = framerate; vFormat.frameRate.Denominator = 1; mediaComposer.setTargetVideoFormat(vFormat); } if (audioFormat != null) { var aFormat = new WinRtAudioFormat(audioMimeType) { bitrate = audioFormat.bitrate, bitsPerSample = audioFormat.bitsPerSample, channelCount = audioFormat.channelCount, sampleRate = audioFormat.sampleRate }; mediaComposer.setTargetAudioFormat(aFormat); } }