Ejemplo n.º 1
0
        private void CreateVideo(string videoName)
        {
            using (var mencod = new Mencoder2(mencoderPath)) {
                mencod.ConversionComplete += (object sender, MplayerEvent e) => {
                    System.IO.File.Move(System.IO.Path.Combine(_imageDirectory, videoName),
                                        System.IO.Path.Combine(_videoDirectory, videoName));
                };

                mencod.Convert($"mf://*.jpg -mf fps={SlideShow.FPS} -ovc lavc harddup -lavcopts vcodec=mpeg4:mbd=2:trell scale=1920:1080 -o {videoName}",
                               _imageDirectory);
            }
        }
Ejemplo n.º 2
0
        private void AddAudio()
        {
            if (System.IO.File.Exists(this._audioFile) == false)
            {
                System.IO.File.Copy(System.IO.Path.Combine(_workingDirectory, "output.avi"), this._outputFilePath);
                return;
            }

            using (var mencod = new Mencoder2(mencoderPath)) {
                // -vf harddup is needed to keep duplicates of the video when adding the audio.  Else you are going to have a huge audio/video sync problem.

                mencod.Convert("\"" + System.IO.Path.Combine(_workingDirectory, "output.avi") + "\" -o \"" + this._outputFilePath + "\" -vf harddup -ovc copy -oac mp3lame -audiofile \"" + this._audioFile + '"');
            }
        }
Ejemplo n.º 3
0
        private void AppendVideo()
        {
            using (var mencod = new Mencoder2(mencoderPath)) {
                // -oac copy -ovc copy -o 'combined_clip.avi' 'clip1.avi' 'clip2.avi'
                var cmd = new StringBuilder();
                cmd.Append("-oac copy -ovc copy -idx -o output.avi");

                foreach (string file in System.IO.Directory.GetFiles(_videoDirectory, "*.avi"))
                {
                    cmd.Append(string.Format(" \"{0}\"", file));
                }

                mencod.ConversionComplete += (object sender, MplayerEvent e) => {
                    System.IO.File.Move(System.IO.Path.Combine(_videoDirectory, "output.avi"),
                                        System.IO.Path.Combine(_workingDirectory, "output.avi"));
                };
                mencod.Convert(cmd.ToString(), _videoDirectory);
            }
        }