/// <summary> /// start to get meta data /// </summary> /// <param name="task"></param> /// <returns></returns> public static async Task <MetaData> GetMetadataAsync(this FFmpegMetadataTask task, FFmpegEnviroment enviroment, CancellationToken cancellationToken = default) { task.AppendCommand(" -f ffmetadata - "); var process = new FFmpegProcess(); await process.ExecuteAsync(task, enviroment, cancellationToken : cancellationToken); return(task.MetaData); }
/// <summary> /// start to convert file /// </summary> /// <param name="task"></param> /// <param name="outputFile"></param> /// <returns></returns> public static async Task <FileInfo> ConvertAsync(this FFmpegConvertTask task, string outputFile, FFmpegEnviroment enviroment, CancellationToken cancellationToken = default) { task.AppendCommand($" \"{outputFile}\" "); var process = new FFmpegProcess(); await process.ExecuteAsync(task, enviroment, cancellationToken : cancellationToken); task.OutputFile = new FileInfo(outputFile); return(task.OutputFile); }
/// <summary> /// start to get thumbnail /// </summary> /// <param name="task"></param> /// <param name="outputFile"></param> /// <returns></returns> public static async Task <FileInfo> GetThumbnailAsync(this FFmpegThumbnailTask task, string outputFile, FFmpegEnviroment enviroment, CancellationToken cancellationToken = default) { task.OutputFile = new FileInfo(outputFile); task.AppendCommand(CultureInfo.InvariantCulture, " -ss {0} ", TimeSpan.FromSeconds(0)); task.AppendCommand(" -vframes {0} ", 1); task.AppendCommand($" \"{outputFile}\" "); var process = new FFmpegProcess(); await process.ExecuteAsync(task, enviroment, cancellationToken : cancellationToken); return(task.OutputFile); }