Skip to content

Commit

Permalink
Added a new mp3 and jpg sample, and added a new Example test that use…
Browse files Browse the repository at this point in the history
…s them.
  • Loading branch information
bramp committed Aug 26, 2017
1 parent 8909038 commit 36c75b8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/test/java/net/bramp/ffmpeg/ExamplesTest.java
Expand Up @@ -11,7 +11,6 @@
import org.mockito.junit.MockitoJUnitRunner;

import java.io.IOException;
import java.util.List;

import static net.bramp.ffmpeg.FFmpegTest.argThatHasItem;
import static org.junit.Assert.assertEquals;
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/net/bramp/ffmpeg/FFmpegExecutorTest.java
Expand Up @@ -241,6 +241,31 @@ public void testProgress() throws InterruptedException, ExecutionException, IOEx
assertThat(progesses.get(progesses.size() - 1).status, is(Progress.Status.END));
}

@Test
public void testIssue112() throws IOException {
FFmpegBuilder builder =
new FFmpegBuilder()
.setInput(Samples.testscreen_jpg)
.addInput(Samples.test_mp3)
.addExtraArgs("-loop", "1")
.overrideOutputFiles(true)
.addOutput(Samples.output_mp4)
.setFormat("mp4")
//.setDuration(30, TimeUnit.SECONDS)
.addExtraArgs("-shortest")
.setAudioCodec("aac")
.setAudioSampleRate(48_000)
.setAudioBitRate(32768)
.setVideoCodec("libx264")
.setVideoFrameRate(24, 1)
.setVideoResolution(640, 480)
.setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // Allow FFmpeg to use experimental specs
.done();

// Run a one-pass encode
ffExecutor.createJob(builder).run();
}

protected void runAndWait(FFmpegJob job) throws ExecutionException, InterruptedException {
executor.submit(job).get();
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/net/bramp/ffmpeg/fixtures/Samples.java
Expand Up @@ -5,10 +5,16 @@ private Samples() {
throw new AssertionError("No instances for you!");
}

// Test sample files (only a handful to keep the repo small)
public static final String TEST_PREFIX = "src/test/resources/net/bramp/ffmpeg/samples/";

public static final String base_big_buck_bunny_720p_1mb = "big_buck_bunny_720p_1mb.mp4";
public static final String base_testscreen_jpg = "testscreen.jpg";
public static final String base_test_mp3 = "test.mp3";

public static final String big_buck_bunny_720p_1mb = TEST_PREFIX + base_big_buck_bunny_720p_1mb;
public static final String testscreen_jpg = TEST_PREFIX + base_testscreen_jpg;
public static final String test_mp3 = TEST_PREFIX + base_test_mp3;

// We don't have the following files
public static final String FAKE_PREFIX = "fake/";
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/net/bramp/ffmpeg/samples/README.md
@@ -1,3 +1,4 @@
Sample media:

big_buck_bunny_720p_1mb.mp4 - Big Buck Bunny - Creative Commons Attribution 3.0
https://archive.org/details/testmp3testfile - https://archive.org/details/testmp3testfile
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 36c75b8

Please sign in to comment.