feat: add fnOS packaging, storage workflows and release pipeline
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using dy.net.utils;
|
||||
using dy.net.Tests.TestInfrastructure;
|
||||
|
||||
namespace dy.net.Tests;
|
||||
|
||||
public class FFmpegHelperTests
|
||||
{
|
||||
[Fact]
|
||||
public void ImageVideoArguments_WithoutAudio_ProduceVideoOnlyCommandWithoutNulls()
|
||||
{
|
||||
var arguments = FFmpegHelper.BuildImageVideoArguments(
|
||||
"/tmp/frames/frame_%03d.webp",
|
||||
null,
|
||||
"/tmp/output.mp4",
|
||||
0.33,
|
||||
"[0:v]scale=1080:1920[v]",
|
||||
1080,
|
||||
1920);
|
||||
|
||||
Assert.DoesNotContain(arguments, value => value == null);
|
||||
Assert.Contains("-an", arguments);
|
||||
Assert.DoesNotContain("1:a", arguments);
|
||||
Assert.Equal(1, arguments.Count(value => value == "-i"));
|
||||
Assert.Equal("/tmp/output.mp4", arguments[^1]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ImageVideoArguments_WithAudio_MapAudioAndUseShortestDuration()
|
||||
{
|
||||
using var temporary = new TemporaryDirectory();
|
||||
var audioPath = Path.Combine(temporary.Path, "audio.mp3");
|
||||
File.WriteAllBytes(audioPath, new byte[] { 1, 2, 3 });
|
||||
var arguments = FFmpegHelper.BuildImageVideoArguments(
|
||||
"/tmp/frames/frame_%03d.webp",
|
||||
audioPath,
|
||||
"/tmp/output.mp4",
|
||||
0.5,
|
||||
"[0:v]scale=1080:1920[v]",
|
||||
1080,
|
||||
1920);
|
||||
|
||||
Assert.DoesNotContain("-an", arguments);
|
||||
Assert.Contains("1:a", arguments);
|
||||
Assert.Contains("-shortest", arguments);
|
||||
Assert.Equal(2, arguments.Count(value => value == "-i"));
|
||||
Assert.Contains(audioPath, arguments);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user