예제 #1
0
 public VideoSource(string inputFile, IFFmpegService ffmpegService, ISourceSetting defaultSetting)
 {
     _ffmpegService     = ffmpegService;
     _workingDirectory  = "temp\\" + Guid.NewGuid().ToString();
     _inputFile         = inputFile;
     _durationInSeconds = _ffmpegService.GetVideoDurationInSeconds(_inputFile);
     _sourceSetting     = defaultSetting;
     UpdateFrames();
 }
예제 #2
0
        private int EnsureLenghtIsValid(string inputFile, ISourceSetting sourceSetting)
        {
            var lenght = GetVideoDurationInSeconds(inputFile);

            if (sourceSetting.GetClipLenght() <= lenght)
            {
                lenght = sourceSetting.GetClipLenght();
            }

            return(lenght);
        }
예제 #3
0
 internal void UpdateSetting(SourceSetting sourceSetting)
 {
     _sourceSetting = sourceSetting;
 }
예제 #4
0
        public IEnumerable <string> GetFramesFromFile(string inputFile, string outputFolder, ISourceSetting sourceSetting)
        {
            Directory.CreateDirectory(outputFolder);

            var lenght = EnsureLenghtIsValid(inputFile, sourceSetting);

            InvokeFFmpeg($"-i \"{inputFile}\" -ss {TimeSpan.FromSeconds(sourceSetting.GetStartTime())} -t {lenght} -r {sourceSetting.GetFrameRate()} \"{outputFolder}\\w%04d.bmp\"");

            return(Directory.EnumerateFiles(outputFolder, "*.bmp"));
        }
예제 #5
0
 public void EncodeFolderAsWebm(string outputFile, string sourceFolder, ISourceSetting sourceSetting)
 {
     InvokeFFmpeg($"-framerate {sourceSetting.GetFrameRate()} -f image2 -i \"{sourceFolder}\" -c:v libvpx-vp9 -pix_fmt yuva420p \"{outputFile}\"");
 }
예제 #6
0
 public VideoExporter(IFFmpegService ffmpegService, ISourceSetting sourceSetting)
 {
     _ffmpegService = ffmpegService;
     _sourceSetting = sourceSetting;
 }
예제 #7
0
 public SourceFactory(IFFmpegService ffmpegService, ISourceSetting defaultSetting)
 {
     _ffmpegService  = ffmpegService;
     _defaultSetting = defaultSetting;
 }