Skip to content

Commit 026fdfd

Browse files
committed
test: Add tests based on bramp#156 and bramp#94
1 parent 328bb1b commit 026fdfd

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

src/test/java/net/bramp/ffmpeg/InputOutputTest.java

+16
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,20 @@ public void outputSubtitleDisabled() {
238238

239239
assertThat(command, is(ImmutableList.of("-y", "-v", "error", "-i", "input.mp4", "-sn", "output.mp4")));
240240
}
241+
242+
@Test
243+
public void setExtraArgsToOnMultipleInputs() {
244+
List<String> command = new FFmpegBuilder()
245+
.addInput("input.mp4")
246+
.addExtraArgs("-t", "10")
247+
.done()
248+
.addInput("input.mkv")
249+
.addExtraArgs("-t", "20")
250+
.done()
251+
.addOutput("output.mp4")
252+
.done()
253+
.build();
254+
255+
assertThat(command, is(ImmutableList.of("-y", "-v", "error", "-t", "10", "-i", "input.mp4", "-t", "20", "-i", "input.mkv", "output.mp4")));
256+
}
241257
}

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

+35
Original file line numberDiff line numberDiff line change
@@ -538,4 +538,39 @@ public void testZeroThreads() {
538538
public void testNegativeNumberOfThreads() {
539539
new FFmpegBuilder().setThreads(-1);
540540
}
541+
542+
@Test
543+
public void testQuestion156(){
544+
List<String> args =
545+
new FFmpegBuilder()
546+
.overrideOutputFiles(true)
547+
.setVerbosity(FFmpegBuilder.Verbosity.INFO)
548+
// X11 screen input
549+
.addInput(":0.0+0,0")
550+
.setFormat("x11grab")
551+
.setVideoResolution("1280x720")
552+
.setVideoFrameRate(30)
553+
.addExtraArgs("-draw_mouse", "0")
554+
.addExtraArgs("-thread_queue_size", "4096")
555+
.done()
556+
// alsa audio input
557+
.addInput("hw:0,1,0")
558+
.setFormat("alsa")
559+
.addExtraArgs("-thread_queue_size", "4096")
560+
.done()
561+
// Youtube output
562+
.addOutput("rtmp://a.rtmp.youtube.com/live2/XXX")
563+
.setAudioCodec("aac")
564+
.setFormat("flv")
565+
.done()
566+
.build();
567+
568+
assertEquals(
569+
ImmutableList.of("-y", "-v", "info",
570+
"-f", "x11grab", "-s", "1280x720", "-r", "30/1", "-draw_mouse", "0", "-thread_queue_size", "4096", "-i", ":0.0+0,0",
571+
"-f", "alsa", "-thread_queue_size", "4096", "-i", "hw:0,1,0",
572+
"-f", "flv", "-acodec", "aac", "rtmp://a.rtmp.youtube.com/live2/XXX"),
573+
args
574+
);
575+
}
541576
}

0 commit comments

Comments
 (0)