Skip to content

Commit ead7e04

Browse files
authored
test: Add specific examples for input builder (#353)
1 parent 25acdc4 commit ead7e04

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

src/test/java/net/bramp/ffmpeg/builder/FFmpegBuilderTest.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,4 +598,72 @@ public void testSetStrict() {
598598

599599
assertEquals(ImmutableList.of("-strict", "experimental", "-y", "-v", "error", "-i", "input.mp4", "output.mp4"), args);
600600
}
601+
602+
@Test
603+
public void testQuestion65() {
604+
List<String> args = new FFmpegBuilder()
605+
.addInput("aevalsrc=0")
606+
.setFormat("lavfi")
607+
.done()
608+
.addInput("1.mp4")
609+
.done()
610+
.addOutput("output.mp4")
611+
.setVideoCodec("copy")
612+
.setAudioCodec("aac")
613+
.addExtraArgs("-map", "0:0")
614+
.addExtraArgs("-map", "1:0")
615+
.addExtraArgs("-shortest")
616+
.done()
617+
.build();
618+
619+
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);
620+
}
621+
622+
@Test
623+
public void testQuestion295() {
624+
List<String> args = new FFmpegBuilder()
625+
.addInput("audio=<device>")
626+
.setFormat("dshow")
627+
.done()
628+
.addInput("desktop")
629+
.setFormat("gdigrab")
630+
.setFrames(30)
631+
.done()
632+
.addOutput("video_file_name.mp4")
633+
.setVideoCodec("libx264")
634+
.done()
635+
.build();
636+
637+
assertEquals(ImmutableList.of(
638+
"-y", "-v", "error", "-f", "dshow", "-i", "audio=<device>", "-f", "gdigrab", "-vframes", "30", "-i", "desktop", "-vcodec", "libx264", "video_file_name.mp4"
639+
), args);
640+
}
641+
642+
@Test
643+
public void testQuestion252() {
644+
List<String> args = new FFmpegBuilder()
645+
.addInput("video_160x90_250k.webm").setFormat("webm_dash_manifest").done()
646+
.addInput("video_320x180_500k.webm").setFormat("webm_dash_manifest").done()
647+
.addInput("video_640x360_750k.webm").setFormat("webm_dash_manifest").done()
648+
.addInput("video_640x360_1000k.webm").setFormat("webm_dash_manifest").done()
649+
.addInput("video_1280x720_600k.webm").setFormat("webm_dash_manifest").done()
650+
.addInput("audio_128k.webm").setFormat("webm_dash_manifest").done()
651+
.addOutput("manifest.mp4")
652+
.setVideoCodec("copy")
653+
.setAudioCodec("copy")
654+
.addExtraArgs("-map", "0")
655+
.addExtraArgs("-map", "1")
656+
.addExtraArgs("-map", "2")
657+
.addExtraArgs("-map", "3")
658+
.addExtraArgs("-map", "4")
659+
.addExtraArgs("-map", "5")
660+
.setFormat("webm_dash_manifest")
661+
.addExtraArgs("-adaptation_sets", "id=0,streams=0,1,2,3,4 id=1,streams=5")
662+
.done()
663+
.build();
664+
665+
assertEquals(ImmutableList.of(
666+
"-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"
667+
), args);
668+
}
601669
}

0 commit comments

Comments
 (0)