mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
parent
5ee26d52ad
commit
9b7bebfd84
2 changed files with 33 additions and 0 deletions
32
FFMpegCore/FFMpeg/Arguments/DemuxConcatArgument.cs
Normal file
32
FFMpegCore/FFMpeg/Arguments/DemuxConcatArgument.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace FFMpegCore.Arguments
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents parameter of concat argument
|
||||
/// Used for creating video from multiple images or videos
|
||||
/// </summary>
|
||||
public class DemuxConcatArgument : IInputArgument
|
||||
{
|
||||
public readonly IEnumerable<string> Values;
|
||||
public DemuxConcatArgument(IEnumerable<string> values)
|
||||
{
|
||||
Values = values;
|
||||
}
|
||||
private readonly string _tempFileName = Path.Combine(FFMpegOptions.Options.TempDirectory, Guid.NewGuid() + ".txt");
|
||||
|
||||
public void Pre()
|
||||
{
|
||||
File.WriteAllLines(_tempFileName, Values);
|
||||
}
|
||||
|
||||
public void Post()
|
||||
{
|
||||
File.Delete(_tempFileName);
|
||||
}
|
||||
|
||||
public string Text => $"-f concat -safe 0 -i \"{_tempFileName}\"";
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ private FFMpegArguments(IInputArgument inputArgument)
|
|||
public static FFMpegArguments FromInputFiles(params FileInfo[] files) => new FFMpegArguments(new InputArgument(false, files));
|
||||
public static FFMpegArguments FromInputFiles(bool verifyExists, params FileInfo[] files) => new FFMpegArguments(new InputArgument(verifyExists, files));
|
||||
public static FFMpegArguments FromConcatenation(params string[] files) => new FFMpegArguments(new ConcatArgument(files));
|
||||
public static FFMpegArguments FromDemuxConcatenation(params string[] files) => new FFMpegArguments(new ConcatArgument(files));
|
||||
public static FFMpegArguments FromPipe(IPipeSource writer) => new FFMpegArguments(new InputPipeArgument(writer));
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue