public void ScreenTest2() { var chunk = new Chunk { IsFaceChunk = false, Id = 23, VideoSource = new ChunkSource { StartTime = 1000, File = "screen", Duration = 1000 }, AudioSource = new ChunkSource { StartTime = 2000, File = "face", Duration = 1000 } }; var cmds = Montager.Commands2(chunk).ToList(); Assert.AreEqual(2, cmds.Count); Assert.IsInstanceOfType(cmds[0], typeof(ExtractScreenVideoCommand)); { var c = (ExtractScreenVideoCommand)cmds[0]; Assert.AreEqual("screen", c.VideoInput); Assert.AreEqual("video023.avi", c.VideoOutput); Assert.AreEqual(1000, c.StartTime); Assert.AreEqual(1000, c.Duration); } Assert.IsInstanceOfType(cmds[1], typeof(ExtractAudioCommand)); { var c = (ExtractAudioCommand)cmds[1]; Assert.AreEqual("face", c.VideoInput); Assert.AreEqual("audio023.mp3", c.AudioOutput); Assert.AreEqual(2000, c.StartTime); Assert.AreEqual(1000, c.Duration); } }
static void Test(MontageLog actions, params Action <Chunk, int>[] checks) { var chunks = Montager.CreateChunks(actions, faceFile, screenFile); Assert.AreEqual(checks.Length, chunks.Count); for (int i = 0; i < chunks.Count; i++) { // Assert.AreEqual(i, chunks[i].Id); по идее, их ID надо проверять отдельно checks[i](chunks[i], i); } }
public void FaceTest() { var chunk = new Chunk { IsFaceChunk = true, Id = 23, VideoSource = new ChunkSource { StartTime = 1000, File = "face", Duration = 1000 } }; var cmds = Montager.Commands1(chunk).ToList(); Assert.AreEqual(1, cmds.Count); Assert.IsInstanceOfType(cmds[0], typeof(ExtractFaceVideoCommand)); var c = (ExtractFaceVideoCommand)cmds[0]; Assert.AreEqual("face", c.VideoInput); Assert.AreEqual("chunk023.avi", c.VideoOutput); Assert.AreEqual(1000, c.StartTime); Assert.AreEqual(1000, c.Duration); }
public void Aggregation1() { var chunks = new List <Chunk> { new Chunk { Id = 1 }, new Chunk { Id = 2 } }; var res = Montager.Aggregation2(chunks, "output").ToList(); Assert.AreEqual(3, res.Count); Assert.IsInstanceOfType(res[0], typeof(ConcatCommand)); { var c = (ConcatCommand)res[0]; Assert.AreEqual(2, c.Files.Count); Assert.AreEqual("audio001.mp3", c.Files[0]); Assert.AreEqual("audio002.mp3", c.Files[1]); Assert.AreEqual("TotalAudio.mp3", c.Result); Assert.AreEqual(true, c.AudioOnly); } Assert.IsInstanceOfType(res[1], typeof(ConcatCommand)); { var c = (ConcatCommand)res[1]; Assert.AreEqual(2, c.Files.Count); Assert.AreEqual("video001.avi", c.Files[0]); Assert.AreEqual("video002.avi", c.Files[1]); Assert.AreEqual("TotalVideo.avi", c.Result); Assert.AreEqual(false, c.AudioOnly); } Assert.IsInstanceOfType(res[2], typeof(MixVideoAudioCommand)); { var c = (MixVideoAudioCommand)res[2]; Assert.AreEqual("TotalAudio.mp3", c.AudioInput); Assert.AreEqual("TotalVideo.avi", c.VideoInput); Assert.AreEqual("output", c.VideoOutput); } }
static void Main(string[] args) { Environment.CurrentDirectory = "..\\..\\..\\..\\Video\\TestFiles\\"; try { Directory.CreateDirectory("Work"); } catch { } Environment.CurrentDirectory += "\\Work\\"; var chunks = new List <Chunk> { new Chunk { Id = 1, VideoSource = new ChunkSource { File = "..\\Original\\123-en.mp4", StartTime = 0, Duration = 1000 } }, new Chunk { Id = 2, VideoSource = new ChunkSource { File = "..\\Original\\123-en.mp4", StartTime = 1000, Duration = 1000 }, AudioSource = new ChunkSource { File = "..\\Original\\123-fr.mp4", StartTime = 1000, Duration = 1000 } }, new Chunk { Id = 3, VideoSource = new ChunkSource { File = "..\\Original\\123-en.mp4", StartTime = 2000, Duration = 1000 }, AudioSource = new ChunkSource { File = "..\\Original\\123-de.mp4", StartTime = 2000, Duration = 1000 } } }; foreach (var e in Directory.GetFiles(".\\", "*.mp*")) { File.Delete(e); } var context = new BatchCommandContext { path = "C:\\ffmpeg\\bin\\ffmpeg.exe" }; foreach (var e in Montager.Processing2(chunks, "output.mp4")) { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine(e.Caption); Console.ForegroundColor = ConsoleColor.Gray; e.WriteToBatch(context); } }