using System.Diagnostics; using Azaion.Repository; using Azaion.Repository.DTO.Configs; using Microsoft.Extensions.Options; namespace Azaion.Video; public interface IFfmpegManager { void ConvertToHls(string video, string segmentFile, string outFile); } public class FfmpegManager(IOptions config) : IFfmpegManager { public void ConvertToHls(string video, string segmentFile, string outFile) { string arguments = string.Concat($"-i \"{video}\" ", "-f hls ", "-hls_time 2 ", "-hls_playlist_type vod ", "-hls_flags independent_segments ", "-hls_segment_type mpegts ", $"-hls_segment_filename \"{segmentFile}\"", $"\"{outFile}\""); var process = new Process { StartInfo = new() { FileName = config.Value.FfmpegExecutable, Arguments = arguments, UseShellExecute = true, }, EnableRaisingEvents = true, }; process.Start(); } }