Exemple #1
0
        public void Concat4ProblemVideosFromArturas_Test()
        {
            const string OutputFile    = OutputFolder + "4Episodes60SecConcat_SuperFast.mkv";
            const string FileToConcat1 = OutputFolder + "1EpisodeToConcat_SuperFast.mp4";
            const string FileToConcat2 = OutputFolder + "2EpisodeToConcat_SuperFast.mp4";
            const string FileToConcat3 = OutputFolder + "3EpisodeToConcat_SuperFast.mp4";
            const string FileToConcat4 = OutputFolder + "4EpisodeToConcat_SuperFast.mp4";

            string Source1 = SampleFiles.RealInputVideoAVI;
            string Source2 = SampleFiles.RealInputVideoAVI2;

            var ffmpeg      = new FFMpeg(this.temporaryFilesStorage);
            var cutOptions1 = FFMpegCutOptions.BuildCatOptionsWithConvertations(Source1, FileToConcat1, 300, 20, GlobalExportProgress.Empty, new Size(1280, 720));

            ffmpeg.Cut(cutOptions1);
            var cutOptions2 = FFMpegCutOptions.BuildCatOptionsWithConvertations(Source1, FileToConcat2, 500, 20, GlobalExportProgress.Empty, new Size(1280, 720));

            ffmpeg.Cut(cutOptions2);
            var cutOptions3 = FFMpegCutOptions.BuildCatOptionsWithConvertations(Source2, FileToConcat3, 100, 20, GlobalExportProgress.Empty, new Size(1280, 720));

            ffmpeg.Cut(cutOptions3);
            var cutOptions4 = FFMpegCutOptions.BuildCatOptionsWithConvertations(Source2, FileToConcat4, 300, 20, GlobalExportProgress.Empty, new Size(1280, 720));

            ffmpeg.Cut(cutOptions4);

            ffmpeg.Concat(OutputFile, "copy", "copy", GlobalExportProgress.Empty, FileToConcat3, FileToConcat4, FileToConcat1, FileToConcat2);

            Assert.IsTrue(File.Exists(OutputFile));
        }
        private void ProcessRenderOptions(VideoRenderOption videoRenderOption, bool plainConcatIsPossible, IGlobalExportProgress globalExportProgress, Size outputSize)
        {
            var tempFile = this.temporaryFilesStorage.GetIntermediateFile(this.OutputExtension);

            var cutOptions = plainConcatIsPossible
                                 ? FFMpegCutOptions.BuildSimpleCatOptions(
                videoRenderOption.FilePath,
                tempFile,
                videoRenderOption.StartSecond,
                videoRenderOption.DurationSeconds,
                globalExportProgress)
                                 : FFMpegCutOptions.BuildCatOptionsWithConvertations(
                videoRenderOption.FilePath,
                tempFile,
                videoRenderOption.StartSecond,
                videoRenderOption.DurationSeconds,
                globalExportProgress,
                outputSize,
                videoRenderOption.OverlayTextTimeTable,
                videoRenderOption.ImagesTimeTable,
                videoRenderOption.TimeWarpSettings);

            this.CutOptions.Add(cutOptions);
            this.FilesToConcat.Add(tempFile);
        }
Exemple #3
0
        public void Cut_Effect_Concat3Videos_Test()
        {
            const string OutputFile    = OutputFolder + "3Episodes60SecConcat_tmp.avi";
            const string FileToConcat1 = OutputFolder + "1EpisodeToConcat_tmp.avi";
            const string FileToConcat2 = OutputFolder + "2EpisodeToConcat_tmp.avi";
            const string FileToConcat3 = OutputFolder + "3EpisodeToConcat_tmp.avi";

            string source = Path.Combine(this.InputFolder, SampleFiles.RealInputVideoAVI2);

            var ffmpeg      = new FFMpeg(this.temporaryFilesStorage);
            var cutOptions1 = FFMpegCutOptions.BuildCatOptionsWithConvertations(source,
                                                                                FileToConcat1,
                                                                                900,
                                                                                20,
                                                                                GlobalExportProgress.Empty,
                                                                                Size.Empty,
                                                                                null,
                                                                                new List <DrawImageTimeRecord>(),
                                                                                new List <TimeWarpRecord>());

            ffmpeg.Cut(cutOptions1);
            var cutOptions2 = FFMpegCutOptions.BuildCatOptionsWithConvertations(source,
                                                                                FileToConcat2,
                                                                                300,
                                                                                20,
                                                                                GlobalExportProgress.Empty,
                                                                                Size.Empty,
                                                                                null,
                                                                                new List <DrawImageTimeRecord>(),
                                                                                new List <TimeWarpRecord>
            {
                new TimeWarpRecord(3, 12, 2)
            });

            ffmpeg.Cut(cutOptions2);
            var cutOptions3 = FFMpegCutOptions.BuildCatOptionsWithConvertations(source,
                                                                                FileToConcat3,
                                                                                600,
                                                                                20,
                                                                                GlobalExportProgress.Empty,
                                                                                Size.Empty,
                                                                                null,
                                                                                new List <DrawImageTimeRecord>(),
                                                                                new List <TimeWarpRecord>
            {
                new TimeWarpRecord(3, 12, 2)
            });

            ffmpeg.Cut(cutOptions3);

            ffmpeg.Concat(OutputFile, "copy", "copy", GlobalExportProgress.Empty, FileToConcat2, FileToConcat1, FileToConcat3);

            Assert.IsTrue(File.Exists(OutputFile));
        }
Exemple #4
0
        public void CutFromTheEndOfLowQualityVideo_Test()
        {
            var          ffmpeg     = new FFMpeg(this.temporaryFilesStorage);
            const string OutputFile = OutputFolder + "CutFromTheEndOfLowQualityVideo.mp4";

            var cutOptions = FFMpegCutOptions.BuildCatOptionsWithConvertations(SampleFiles.LowQualityVideo,
                                                                               OutputFile,
                                                                               4000,
                                                                               20,
                                                                               GlobalExportProgress.Empty,
                                                                               new Size(640, 360));

            ffmpeg.Cut(cutOptions);

            Assert.IsTrue(File.Exists(OutputFile));
        }