예제 #1
0
        public void Test01_a(string wavFile, string imgFile, string mp4File)
        {
            using (WorkingDir wd = new WorkingDir())
            {
                string imgDir = wd.GetPath("img");

                FileTools.CreateDir(imgDir);

                PictureData picture = new PictureData(new Canvas2(imgFile), 1920, 1080);
                WaveData    wave    = new WaveData(wavFile);

                VideoData video  = new VideoData(picture, (wave.Length * VideoData.FPS) / wave.WavHz, imgDir);
                IEffect   effect = new SpectrumEffect01(wave);

                video.MakeImages(new VideoData.FadeInOutInfo()
                {
                    StartMargin   = 2 * VideoData.FPS,
                    EndMargin     = -1,
                    FadeInOutSpan = 20,
                },
                                 effect,
                                 new VideoData.FadeInOutInfo()
                {
                    StartMargin   = -1,
                    EndMargin     = 10,
                    FadeInOutSpan = 10,
                });

                File.Copy(wavFile, wd.GetPath("audio.wav"));

                ProcessTools.Batch(new string[]
                {
                    @"C:\app\ffmpeg-4.1.3-win64-shared\bin\ffmpeg.exe -r 20 -i %%d.jpg -i ..\audio.wav ..\out.mp4",
                },
                                   imgDir
                                   );

                File.Copy(wd.GetPath("out.mp4"), mp4File, true);
            }
        }