Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void testConvertWebm() throws Exception {
- final String webmFormat = "webm";
- final String webmAudioCodec = "libvorbis";
- final String webmVideoCodec = "libvpx";
- final FFmpeg ffmpeg = new FFmpeg(ffmpegPath);
- final FFprobe ffprobe = new FFprobe(ffprobePath);
- ExecutorService pool = Executors.newFixedThreadPool(5);
- for (int i = 0; i < 5; ++i) {
- final int x = i;
- pool.submit(new Runnable() {
- @Override
- public void run() {
- String outputVideoPath = System.getProperty("java.io.tmpdir") + "/output" + x + ".webm";
- try {
- FFmpegBuilder builder = new FFmpegBuilder()
- .setInput(inputTestVideo)
- .overrideOutputFiles(true)
- .addOutput(outputVideoPath)
- .setFormat(webmFormat)
- .setAudioCodec(webmAudioCodec)
- .setVideoCodec(webmVideoCodec)
- .setVideoResolution(422, 240)
- .done();
- FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
- executor.createJob(builder).run();
- } finally {
- File outputVideo = new File(outputVideoPath);
- if (!outputVideo.exists()) {
- fail();
- } else {
- outputVideo.delete();
- }
- }
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement