예제 #1
0
        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);
            }
        }
예제 #2
0
        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));
                }
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
        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));
                }
            }
        }