Example #1
0
 public static IEnumerable<BatchCommand> Commands2(Chunk chunk)
 {
     if (chunk.IsFaceChunk)
         yield return new ExtractFaceVideoCommand
         {
             VideoInput = chunk.VideoSource.File,
             StartTime = chunk.VideoSource.StartTime,
             Duration = chunk.VideoSource.Duration,
             VideoOutput = chunk.TemporalVideoFile
         };
     else
         yield return new ExtractScreenVideoCommand
         {
             VideoInput = chunk.VideoSource.File,
             StartTime = chunk.VideoSource.StartTime,
             Duration = chunk.VideoSource.Duration,
             VideoOutput = chunk.TemporalVideoFile
         };
     var s = chunk.AudioSource ?? chunk.VideoSource;
     yield return new ExtractAudioCommand
     {
         VideoInput = s.File,
         StartTime = s.StartTime,
         Duration = s.Duration,
         AudioOutput = chunk.TemporalAudioFile
     };
 }
        public void FaceTest2()
        {
            var chunk = new Chunk
            {
                IsFaceChunk=true,
                Id = 23,
                VideoSource = new ChunkSource { StartTime = 1000, File = "face", Duration = 1000 }

            };

            var cmds = Montager.Commands2(chunk).ToList();
            Assert.AreEqual(2, cmds.Count);
            Assert.IsInstanceOfType(cmds[0], typeof(ExtractFaceVideoCommand));
            {
                var c = (ExtractFaceVideoCommand)cmds[0];
                Assert.AreEqual("face", 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(1000, c.StartTime);
                Assert.AreEqual(1000, c.Duration);
            }
        }
Example #3
0
 public static IEnumerable<BatchCommand> Commands1(Chunk chunk)
 {
     if (chunk.IsFaceChunk)
     {
         yield return new ExtractFaceVideoCommand
             {
                 VideoInput = chunk.VideoSource.File,
                 StartTime = chunk.VideoSource.StartTime,
                 Duration = chunk.VideoSource.Duration,
                 VideoOutput = chunk.OutputVideoFile
             };
     }
     else
     {
        yield return new ExtractAudioCommand
         {
             VideoInput=chunk.AudioSource.File,
             StartTime=chunk.AudioSource.StartTime,
             Duration=chunk.AudioSource.Duration,
             AudioOutput=chunk.TemporalAudioFile
         };
        yield return new ExtractScreenVideoCommand
        {
            VideoInput = chunk.VideoSource.File,
            StartTime = chunk.VideoSource.StartTime,
            Duration = chunk.VideoSource.Duration,
            VideoOutput = chunk.TemporalVideoFile
        };
         yield return new MixVideoAudioCommand
         {
             VideoInput=chunk.TemporalVideoFile,
             AudioInput=chunk.TemporalAudioFile,
             VideoOutput=chunk.OutputVideoFile
         };
     }
 }
 public void ScreenTest()
 {
     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.Commands1(chunk).ToList();
     Assert.AreEqual(3, cmds.Count);
     Assert.IsInstanceOfType(cmds[0], typeof(ExtractAudioCommand));
     {
         var c = (ExtractAudioCommand)cmds[0];
         Assert.AreEqual("face", c.VideoInput);
         Assert.AreEqual("audio023.mp3", c.AudioOutput);
         Assert.AreEqual(2000, c.StartTime);
         Assert.AreEqual(1000, c.Duration);
     }
     Assert.IsInstanceOfType(cmds[1], typeof(ExtractScreenVideoCommand));
     {
         var c = (ExtractScreenVideoCommand)cmds[1];
         Assert.AreEqual("screen", c.VideoInput);
         Assert.AreEqual("video023.avi", c.VideoOutput);
         Assert.AreEqual(1000, c.StartTime);
         Assert.AreEqual(1000, c.Duration);
     }
     Assert.IsInstanceOfType(cmds[2], typeof(MixVideoAudioCommand));
     {
         var c = (MixVideoAudioCommand)cmds[2];
         Assert.AreEqual("video023.avi", c.VideoInput);
         Assert.AreEqual("audio023.mp3", c.AudioInput);
         Assert.AreEqual("chunk023.avi", c.VideoOutput);
     }
 }