Skip to content

Commit

Permalink
Added frame counting test using streamcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfryd committed Aug 20, 2024
1 parent 512cff1 commit d7100e5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/java/com/github/kokorin/jaffree/ffmpeg/FFmpegTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,29 @@ public void onProgress(FFmpegProgress progress) {
.execute();
}

@Test
public void testFrameCountingWithStreamCopyAndProgressListener() throws Exception {
final AtomicReference<Long> frameRef = new AtomicReference<>();

final ProgressListener progressListener = new ProgressListener() {
@Override
public void onProgress(FFmpegProgress progress) {
System.out.println(progress);
frameRef.set(progress.getFrame());
}
};

final FFmpegResult result = FFmpeg.atPath(Config.FFMPEG_BIN)
.addInput(UrlInput.fromPath(Artifacts.VIDEO_NUT))
.addOutput(new NullOutput())
.setProgressListener(progressListener)
.execute();

// Note fails in FFmpeg 6.1, 6.1.1, 6.1.2, 7.0, 7.0.1, 7.0.2. To be fixed in the next release, see:
// https://github.com/FFmpeg/FFmpeg/commit/598f541ba49cb682dcd74e86858c9a4985149e1f
assertNotNull(frameRef.get());
}

@Test
public void testForceStopWithThreadInterruption() throws Exception {
Path tempDir = Files.createTempDirectory("jaffree");
Expand Down

0 comments on commit d7100e5

Please sign in to comment.