mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:26:31 +00:00
7807f5bc90
configure auto-scan folder and create hls files job WIP
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
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<FoldersConfig> 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();
|
|
}
|
|
} |