|
12 | 12 | import com.google.common.io.ByteStreams; |
13 | 13 | import com.google.common.io.CountingOutputStream; |
14 | 14 | import com.google.common.net.HostAndPort; |
| 15 | + |
| 16 | +import java.io.File; |
15 | 17 | import java.io.IOException; |
16 | 18 | import java.util.List; |
17 | 19 | import java.util.concurrent.ExecutionException; |
@@ -268,6 +270,43 @@ public void testIssue112() { |
268 | 270 | ffExecutor.createJob(builder).run(); |
269 | 271 | } |
270 | 272 |
|
| 273 | + |
| 274 | + @Test |
| 275 | + public void testIssue287() throws InterruptedException, ExecutionException, IOException { |
| 276 | + FFmpegProbeResult in = ffprobe.probe(Samples.big_buck_bunny_720p_1mb); |
| 277 | + assertFalse(in.hasError()); |
| 278 | + |
| 279 | + String tempDir = System.getProperty("java.io.tmpdir"); |
| 280 | + |
| 281 | + FFmpegBuilder builder = |
| 282 | + new FFmpegBuilder() |
| 283 | + .setInput(in) |
| 284 | + .done() |
| 285 | + .overrideOutputFiles(true) |
| 286 | + .addOutput(Samples.output_mp4) |
| 287 | + .setFormat("mp4") |
| 288 | + .disableAudio() |
| 289 | + .setVideoCodec("mpeg4") |
| 290 | + .setVideoFrameRate(FFmpeg.FPS_30) |
| 291 | + .setVideoResolution(320, 240) |
| 292 | + .setTargetSize(1024 * 1024) |
| 293 | + .done().setPassDirectory(tempDir); |
| 294 | + |
| 295 | + FFmpegJob job = ffExecutor.createTwoPassJob(builder); |
| 296 | + runAndWait(job); |
| 297 | + |
| 298 | + assertEquals(FFmpegJob.State.FINISHED, job.getState()); |
| 299 | + |
| 300 | + File passDir = new File(builder.getPassDirectory()); |
| 301 | + String passPrefix = builder.getPassPrefix(); |
| 302 | + |
| 303 | + File[] remainingFiles = passDir.listFiles((dir, name) -> |
| 304 | + name.startsWith(passPrefix) && name.contains(".log") |
| 305 | + ); |
| 306 | + |
| 307 | + assertEquals(true, remainingFiles == null || remainingFiles.length == 0); |
| 308 | + } |
| 309 | + |
271 | 310 | protected void runAndWait(FFmpegJob job) throws ExecutionException, InterruptedException { |
272 | 311 | executor.submit(job).get(); |
273 | 312 | } |
|
0 commit comments