private void AppendVideo() { var mencod = new Mencoder(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(System.Environment.CurrentDirectory, "*.avi")) { cmd.Append(string.Format(" \"{0}\"", file)); } bool finished = false; mencod.ConversionComplete += (object sender, MplayerEvent e) => { System.IO.File.Move(System.IO.Path.Combine(_videoDirectory, "output.avi"), System.IO.Path.Combine("../", "output.avi")); finished = true; }; mencod.Convert(cmd.ToString()); while (!finished) { System.Threading.Thread.Sleep(200); } }
private void CreateVideo(string videoName) { var mencod = new Mencoder(mencoderPath); bool finished = false; mencod.ConversionComplete += (object sender, MplayerEvent e) => { System.IO.File.Move(System.IO.Path.Combine(System.Environment.CurrentDirectory, videoName), System.IO.Path.Combine(_videoDirectory, videoName)); finished = true; }; mencod.Convert(string.Format("mf://*.jpg -mf fps={0} -ovc lavc harddup -lavcopts vcodec=mpeg4:mbd=2:trell -o {1}", SlideShow.FPS, videoName)); while (!finished) { System.Threading.Thread.Sleep(200); } }
private void AddAudio() { if (System.IO.File.Exists(this._audioFile) == false) { System.IO.File.Copy("output.avi", this._outputFilePath); return; } var mencod = new Mencoder(mencoderPath); bool finished = false; mencod.ConversionComplete += (object sender, MplayerEvent e) => { finished = true; }; // -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 + '"'); while (!finished) { System.Threading.Thread.Sleep(200); } }