Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string input = @"C:\Users\a\Videos\Debut\Untitled 7.avi";

            string output = "C:\\test3.avi";

            var setting = new NReco.VideoConverter.ConvertSettings();

            setting.SetVideoFrameSize(1280, 720);
            setting.CustomInputArgs = "-ss 00:00:00 -t 00:00:10";
            // setting.CustomOutputArgs = "-vf vflip";
            setting.CustomOutputArgs = "-vf \"movie=logo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]\"";


            //            Top left corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv

            //Top right corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv

            //Bottom left corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" outputvideo.flv

            //Bottom right corner
            //ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" outputvideo.flv



            var ffMpeg = new NReco.VideoConverter.FFMpegConverter();

            ffMpeg.ConvertProgress += FfMpeg_ConvertProgress;

            ffMpeg.GetVideoThumbnail(input, "temp.jpg", 10.0f);
            System.IO.FileStream hStream = new System.IO.FileStream("temp.jpg", System.IO.FileMode.Open);
            this.pictureBox1.Image = Image.FromStream(hStream);
            // FileStream を閉じる (正しくは オブジェクトの破棄を保証する を参照)
            hStream.Close();
            return;

            //ffMpeg.ConvertMedia(input, null, output, null, setting);

            ffMpeg.ConvertMedia(input, null, output, NReco.VideoConverter.Format.mp4, setting);
            //


            NReco.VideoConverter.ConcatSettings set = new NReco.VideoConverter.ConcatSettings();
            set.SetVideoFrameSize(640, 480);
            //ffMpeg.ConcatMedia(_fileNames, videoRootPath + tobename + ".mp4", NReco.VideoConverter.Format.mp4, set);

            this.Text = "FINISH";
        }
Example #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            var ffMpeg = new NReco.VideoConverter.FFMpegConverter();

            NReco.VideoConverter.ConcatSettings set = new NReco.VideoConverter.ConcatSettings();
            set.SetVideoFrameSize(640, 480);
            set.ConcatAudioStream = false;
            set.ConcatVideoStream = true;
            //set.CustomOutputArgs = "-filter_complex '[0:v] setsar=sar=1 [in1]; [1:v] setsar=sar=1 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]'";
            //set.CustomOutputArgs = "-filter_complex \"[0:0] setsar=1/1[sarfix];[sarfix] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a] \" -map \"[v]\" -map \"[a]\"";
            string[] inputfiles = { "opening.mp4", tempout };
            ffMpeg.ConcatMedia(inputfiles, output, NReco.VideoConverter.Format.mp4, set);
            MessageBox.Show("FINISHED");
        }