public VideoSource(string inputFile, IFFmpegService ffmpegService, ISourceSetting defaultSetting) { _ffmpegService = ffmpegService; _workingDirectory = "temp\\" + Guid.NewGuid().ToString(); _inputFile = inputFile; _durationInSeconds = _ffmpegService.GetVideoDurationInSeconds(_inputFile); _sourceSetting = defaultSetting; UpdateFrames(); }
private int EnsureLenghtIsValid(string inputFile, ISourceSetting sourceSetting) { var lenght = GetVideoDurationInSeconds(inputFile); if (sourceSetting.GetClipLenght() <= lenght) { lenght = sourceSetting.GetClipLenght(); } return(lenght); }
internal void UpdateSetting(SourceSetting sourceSetting) { _sourceSetting = sourceSetting; }
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")); }
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}\""); }
public VideoExporter(IFFmpegService ffmpegService, ISourceSetting sourceSetting) { _ffmpegService = ffmpegService; _sourceSetting = sourceSetting; }
public SourceFactory(IFFmpegService ffmpegService, ISourceSetting defaultSetting) { _ffmpegService = ffmpegService; _defaultSetting = defaultSetting; }