Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
1.3 KiB

using CliWrap;
using ErsatzTV.Scanner.Core.Interfaces.FFmpeg;
namespace ErsatzTV.Scanner.Core.FFmpeg;
public class FFmpegPngService : IFFmpegPngService
{
public Command ConvertToPng(string ffmpegPath, string inputFile, string outputFile)
{
string[] arguments =
{
"-threads", "1",
"-nostdin",
"-hide_banner", "-loglevel", "error", "-nostats",
"-i", inputFile,
"-f", "apng", "-y", outputFile
};
return Cli.Wrap(ffmpegPath)
.WithArguments(arguments)
.WithValidation(CommandResultValidation.None)
.WithStandardErrorPipe(PipeTarget.ToStream(Stream.Null));
}
public Command ExtractAttachedPicAsPng(string ffmpegPath, string inputFile, int streamIndex, string outputFile)
{
string[] arguments =
{
"-threads", "1",
"-nostdin",
"-hide_banner", "-loglevel", "error", "-nostats",
"-i", inputFile,
"-map", $"0:{streamIndex}",
"-f", "apng", "-y", outputFile
};
return Cli.Wrap(ffmpegPath)
.WithArguments(arguments)
.WithValidation(CommandResultValidation.None)
.WithStandardErrorPipe(PipeTarget.ToStream(Stream.Null));
}
}