From ead7e046f715dd418efa9f77463ede6579a150d2 Mon Sep 17 00:00:00 2001 From: Euklios Date: Thu, 22 Aug 2024 10:32:11 +0200 Subject: [PATCH] test: Add specific examples for input builder (#353) --- .../ffmpeg/builder/FFmpegBuilderTest.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/test/java/net/bramp/ffmpeg/builder/FFmpegBuilderTest.java b/src/test/java/net/bramp/ffmpeg/builder/FFmpegBuilderTest.java index a0042d8d..33ddfa6e 100644 --- a/src/test/java/net/bramp/ffmpeg/builder/FFmpegBuilderTest.java +++ b/src/test/java/net/bramp/ffmpeg/builder/FFmpegBuilderTest.java @@ -598,4 +598,72 @@ public void testSetStrict() { assertEquals(ImmutableList.of("-strict", "experimental", "-y", "-v", "error", "-i", "input.mp4", "output.mp4"), args); } + + @Test + public void testQuestion65() { + List args = new FFmpegBuilder() + .addInput("aevalsrc=0") + .setFormat("lavfi") + .done() + .addInput("1.mp4") + .done() + .addOutput("output.mp4") + .setVideoCodec("copy") + .setAudioCodec("aac") + .addExtraArgs("-map", "0:0") + .addExtraArgs("-map", "1:0") + .addExtraArgs("-shortest") + .done() + .build(); + + assertEquals(ImmutableList.of("-y", "-v", "error", "-f", "lavfi", "-i", "aevalsrc=0", "-i", "1.mp4", "-vcodec", "copy", "-acodec", "aac", "-map", "0:0", "-map", "1:0", "-shortest", "output.mp4"), args); + } + + @Test + public void testQuestion295() { + List args = new FFmpegBuilder() + .addInput("audio=") + .setFormat("dshow") + .done() + .addInput("desktop") + .setFormat("gdigrab") + .setFrames(30) + .done() + .addOutput("video_file_name.mp4") + .setVideoCodec("libx264") + .done() + .build(); + + assertEquals(ImmutableList.of( + "-y", "-v", "error", "-f", "dshow", "-i", "audio=", "-f", "gdigrab", "-vframes", "30", "-i", "desktop", "-vcodec", "libx264", "video_file_name.mp4" + ), args); + } + + @Test + public void testQuestion252() { + List args = new FFmpegBuilder() + .addInput("video_160x90_250k.webm").setFormat("webm_dash_manifest").done() + .addInput("video_320x180_500k.webm").setFormat("webm_dash_manifest").done() + .addInput("video_640x360_750k.webm").setFormat("webm_dash_manifest").done() + .addInput("video_640x360_1000k.webm").setFormat("webm_dash_manifest").done() + .addInput("video_1280x720_600k.webm").setFormat("webm_dash_manifest").done() + .addInput("audio_128k.webm").setFormat("webm_dash_manifest").done() + .addOutput("manifest.mp4") + .setVideoCodec("copy") + .setAudioCodec("copy") + .addExtraArgs("-map", "0") + .addExtraArgs("-map", "1") + .addExtraArgs("-map", "2") + .addExtraArgs("-map", "3") + .addExtraArgs("-map", "4") + .addExtraArgs("-map", "5") + .setFormat("webm_dash_manifest") + .addExtraArgs("-adaptation_sets", "id=0,streams=0,1,2,3,4 id=1,streams=5") + .done() + .build(); + + assertEquals(ImmutableList.of( + "-y", "-v", "error", "-f", "webm_dash_manifest", "-i", "video_160x90_250k.webm", "-f", "webm_dash_manifest", "-i", "video_320x180_500k.webm", "-f", "webm_dash_manifest", "-i", "video_640x360_750k.webm", "-f", "webm_dash_manifest", "-i", "video_640x360_1000k.webm", "-f", "webm_dash_manifest", "-i", "video_1280x720_600k.webm", "-f", "webm_dash_manifest", "-i", "audio_128k.webm", "-f", "webm_dash_manifest", "-vcodec", "copy", "-acodec", "copy", "-map", "0", "-map", "1", "-map", "2", "-map", "3", "-map", "4", "-map", "5", "-adaptation_sets", "id=0,streams=0,1,2,3,4 id=1,streams=5", "manifest.mp4" + ), args); + } }