public void CanMakeMovie() { FileSystemHelper.DeleteIfExists(Path.Combine(dir, "dirty-movie.avi")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "dirty-movie.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_01.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_rawmovie.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_02.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_03.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_04.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "movie.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_movieset.tmp")); // we cannot make avi directly but want to show ability to make movie from avi MakeSlideShow("dirty-movie.mp4", 0.1m); FFMpeg.Convert(new FFMpegConvertTask { SourceFile = GetPath("dirty-movie.mp4"), TargetFile = GetPath("dirty-movie.avi"), }); var task = new FFMpegCreateMovieTask { WorkingFolder = dir, TmpFileBasis = "frame_", SourceFile = GetPath("dirty-movie.avi"), TargetFile = GetPath("movie.mp4"), }; task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(0.5) }); task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(11), Duration = TimeSpan.FromSeconds(0.5) }); task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(0.5) }); task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(12), Duration = TimeSpan.FromSeconds(0.5) }); FFMpeg.CreateMovie(task); Assert.True(File.Exists(GetPath("movie.mp4"))); Assert.True(File.Exists(GetPath("frame_movieset.tmp"))); }
public void CanMakeMovie() { FileSystemHelper.DeleteIfExists(Path.Combine(dir, "dirty-movie.avi")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "dirty-movie.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_01.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_rawmovie.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_02.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_03.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_04.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "movie.mp4")); FileSystemHelper.DeleteIfExists(Path.Combine(dir, "frame_movieset.tmp")); // we cannot make avi directly but want to show ability to make movie from avi MakeSlideShow("dirty-movie.mp4",0.1m); FFMpeg.Convert(new FFMpegConvertTask{SourceFile = GetPath("dirty-movie.mp4"),TargetFile = GetPath("dirty-movie.avi"),}); var task = new FFMpegCreateMovieTask { WorkingFolder = dir, TmpFileBasis = "frame_", SourceFile = GetPath("dirty-movie.avi"), TargetFile = GetPath("movie.mp4"), }; task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(0.5) }); task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(11), Duration = TimeSpan.FromSeconds(0.5) }); task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(0.5) }); task.Frames.Add(new FFMpegFrame { StartTime = TimeSpan.FromSeconds(12), Duration = TimeSpan.FromSeconds(0.5) }); FFMpeg.CreateMovie(task); Assert.True(File.Exists(GetPath("movie.mp4"))); Assert.True(File.Exists(GetPath("frame_movieset.tmp"))); }