From 232289d439d1a84775ddf82419bdcd495fba180d Mon Sep 17 00:00:00 2001 From: a-schild Date: Tue, 15 Oct 2019 14:42:28 +0200 Subject: [PATCH] 2.6.1 with support for default screenshot size images --- README.md | 16 ++++----- jave-all-deps/pom.xml | 14 ++++---- jave-core-test-java11/pom.xml | 14 ++++---- jave-core-test/pom.xml | 14 ++++---- jave-core/pom.xml | 2 +- .../ws/schild/jave/DefaultFFMPEGLocator.java | 2 +- .../java/ws/schild/jave/ScreenExtractor.java | 36 ++++++++++--------- jave-example/pom.xml | 6 ++-- jave-nativebin-linux32/pom.xml | 2 +- jave-nativebin-linux64/pom.xml | 2 +- jave-nativebin-osx64/pom.xml | 2 +- jave-nativebin-win32/pom.xml | 2 +- jave-nativebin-win64/pom.xml | 2 +- pom.xml | 4 +-- 14 files changed, 61 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 673cd11..6947408 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ It includes all binaries for the supported platforms ws.schild jave-all-deps - 2.6.0 + 2.6.1 ``` @@ -60,7 +60,7 @@ Generally if you want to use for one platform or more what you have to do is add ws.schild jave-core - 2.6.0 + 2.6.1 ``` @@ -71,7 +71,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-linux64 - 2.6.0 + 2.6.1 ``` @@ -80,7 +80,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-win64 - 2.6.0 + 2.6.1 ``` @@ -89,7 +89,7 @@ and then the specific jar(s) for your platform(s) : ws.schild jave-nativebin-osx64 - 2.6.0 + 2.6.1 ``` @@ -98,13 +98,13 @@ and then the specific jar(s) for your platform(s) : It includes all binaries for the supported platforms ``` XML -compile group: 'ws.schild', name: 'jave-all-deps', version: '2.6.0' +compile group: 'ws.schild', name: 'jave-all-deps', version: '2.6.1' ``` ### For one platform only (Linux 64Bit in this case) ``` XML -compile group: 'ws.schild', name: 'jave-core', version: '2.6.0' -compile group: 'ws.schild', name: 'jave-nativebin-linux64', version: '2.6.0' +compile group: 'ws.schild', name: 'jave-core', version: '2.6.1' +compile group: 'ws.schild', name: 'jave-nativebin-linux64', version: '2.6.1' ``` ### Main Components of Jave2 diff --git a/jave-all-deps/pom.xml b/jave-all-deps/pom.xml index 56c727f..847674a 100644 --- a/jave-all-deps/pom.xml +++ b/jave-all-deps/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-all-deps Jave all native dependencies package The JAVE (Java Audio Video Encoder) library is Java wrapper on the @@ -152,32 +152,32 @@ ws.schild jave-core - 2.6.0 + 2.6.1 ws.schild jave-nativebin-win32 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-win64 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux32 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux64 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-osx64 - 2.6.0 + 2.6.1 diff --git a/jave-core-test-java11/pom.xml b/jave-core-test-java11/pom.xml index aecfd04..2890e44 100644 --- a/jave-core-test-java11/pom.xml +++ b/jave-core-test-java11/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-core-test-java11 11 @@ -38,32 +38,32 @@ ws.schild jave-core - 2.6.0 + 2.6.1 ws.schild jave-nativebin-win32 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-win64 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux32 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux64 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-osx64 - 2.6.0 + 2.6.1 diff --git a/jave-core-test/pom.xml b/jave-core-test/pom.xml index 1963bff..ba989ac 100644 --- a/jave-core-test/pom.xml +++ b/jave-core-test/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-core-test 1.8 @@ -38,32 +38,32 @@ ws.schild jave-core - 2.6.0 + 2.6.1 ws.schild jave-nativebin-win32 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-win64 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux32 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux64 - 2.6.0 + 2.6.1 ws.schild jave-nativebin-osx64 - 2.6.0 + 2.6.1 diff --git a/jave-core/pom.xml b/jave-core/pom.xml index 0327728..da09c8d 100644 --- a/jave-core/pom.xml +++ b/jave-core/pom.xml @@ -4,7 +4,7 @@ ws.schild jave-core jar - 2.6.0 + 2.6.1 Jave core package The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project. Developers can take take advantage of JAVE2 to transcode diff --git a/jave-core/src/main/java/ws/schild/jave/DefaultFFMPEGLocator.java b/jave-core/src/main/java/ws/schild/jave/DefaultFFMPEGLocator.java index 26ff72c..544f3b8 100644 --- a/jave-core/src/main/java/ws/schild/jave/DefaultFFMPEGLocator.java +++ b/jave-core/src/main/java/ws/schild/jave/DefaultFFMPEGLocator.java @@ -43,7 +43,7 @@ public class DefaultFFMPEGLocator extends FFMPEGLocator { * Trace the version of the bundled ffmpeg executable. It's a counter: every * time the bundled ffmpeg change it is incremented by 1. */ - private static final String MY_EXE_VERSION = "2.6.0"; + private static final String MY_EXE_VERSION = "2.6.1"; /** * The ffmpeg executable file path. diff --git a/jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java b/jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java index b40a279..334c745 100644 --- a/jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java +++ b/jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java @@ -47,8 +47,8 @@ public ScreenExtractor(FFMPEGLocator locator) { * Generates screenshots from source video. * * @param multimediaObject Source MultimediaObject @see MultimediaObject - * @param width Output width - * @param height Output height + * @param width Output width, pass -1 to use video width and height + * @param height Output height (Ignored when width = -1) * @param seconds Interval in seconds between screens * @param outputDir Destination of output images * @param fileNamePrefix Name all thumbnails will start with @@ -93,8 +93,11 @@ public void render(MultimediaObject multimediaObject, int width, int height, int ffmpeg.addArgument("image2"); ffmpeg.addArgument("-vf"); ffmpeg.addArgument(String.format("fps=fps=1/%s", String.valueOf(seconds))); - ffmpeg.addArgument("-s"); - ffmpeg.addArgument(String.format("%sx%s", String.valueOf(width), String.valueOf(height))); + if (width != -1) + { + ffmpeg.addArgument("-s"); + ffmpeg.addArgument(String.format("%sx%s", String.valueOf(width), String.valueOf(height))); + } ffmpeg.addArgument("-qscale"); ffmpeg.addArgument(String.valueOf(quality)); ffmpeg.addArgument(String.format("%s%s%s-%%04d.%s", @@ -133,21 +136,21 @@ public void render(MultimediaObject multimediaObject, int width, int height, int * Generate a single screenshot from source video. * * @param multimediaObject Source MultimediaObject @see MultimediaObject - * @param width Output width - * @param height Output height + * @param width Output width, pass -1 to use video width and height + * @param height Output height (Ignored when width = -1) * @param seconds Interval in seconds between screens - * @param target Destination of output image + * @param outputDir Destination folder of output image * @param quality The range is between 1-31 with 31 being the worst quality * @throws InputFormatException If the source multimedia file cannot be * decoded. * @throws EncoderException If a problems occurs during the encoding * process. */ - public void render(MultimediaObject multimediaObject, int width, int height, int seconds, File target, int quality) + public void render(MultimediaObject multimediaObject, int width, int height, int seconds, File outputDir, int quality) throws EncoderException { String inputSource = multimediaObject.isURL() ? multimediaObject.getURL().toString() : multimediaObject.getFile().getAbsolutePath(); - target = target.getAbsoluteFile(); - target.getParentFile().mkdirs(); + outputDir = outputDir.getAbsoluteFile(); + outputDir.getParentFile().mkdirs(); try { if (!multimediaObject.isURL() && !multimediaObject.getFile().canRead()) @@ -172,12 +175,15 @@ public void render(MultimediaObject multimediaObject, int width, int height, int ffmpeg.addArgument("-vframes"); ffmpeg.addArgument("1"); ffmpeg.addArgument("-ss"); - ffmpeg.addArgument(String.valueOf(seconds)); - ffmpeg.addArgument("-s"); - ffmpeg.addArgument(String.format("%sx%s", String.valueOf(width), String.valueOf(height))); + ffmpeg.addArgument(Utils.buildTimeDuration(seconds*1000)); + if (width != -1) + { + ffmpeg.addArgument("-s"); + ffmpeg.addArgument(String.format("%sx%s", String.valueOf(width), String.valueOf(height))); + } ffmpeg.addArgument("-qscale"); ffmpeg.addArgument(String.valueOf(quality)); - ffmpeg.addArgument(target.getAbsolutePath()); + ffmpeg.addArgument(outputDir.getAbsolutePath()); try { @@ -246,8 +252,6 @@ public void renderOneImage(MultimediaObject multimediaObject, LOG.debug("Access denied checking destination folder", e); } - MultimediaInfo multimediaInfo = multimediaObject.getInfo(); - FFMPEGExecutor ffmpeg = this.locator.createExecutor(); ffmpeg.addArgument("-i"); ffmpeg.addArgument(inputSource); diff --git a/jave-example/pom.xml b/jave-example/pom.xml index ade0410..5d8c11a 100644 --- a/jave-example/pom.xml +++ b/jave-example/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-example 1.8 @@ -66,12 +66,12 @@ ws.schild jave-core - 2.6.0 + 2.6.1 ws.schild jave-nativebin-linux32 - 2.6.0 + 2.6.1 diff --git a/jave-nativebin-linux32/pom.xml b/jave-nativebin-linux32/pom.xml index f259502..650e11a 100644 --- a/jave-nativebin-linux32/pom.xml +++ b/jave-nativebin-linux32/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-nativebin-linux32 Jave linux 32 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the diff --git a/jave-nativebin-linux64/pom.xml b/jave-nativebin-linux64/pom.xml index 97b1abb..66ae6be 100644 --- a/jave-nativebin-linux64/pom.xml +++ b/jave-nativebin-linux64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-nativebin-linux64 Jave linux 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the diff --git a/jave-nativebin-osx64/pom.xml b/jave-nativebin-osx64/pom.xml index a568484..f889aa3 100644 --- a/jave-nativebin-osx64/pom.xml +++ b/jave-nativebin-osx64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-nativebin-osx64 Jave OSX 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the diff --git a/jave-nativebin-win32/pom.xml b/jave-nativebin-win32/pom.xml index e1c6125..dfabce5 100644 --- a/jave-nativebin-win32/pom.xml +++ b/jave-nativebin-win32/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-nativebin-win32 Jave windows 32 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the diff --git a/jave-nativebin-win64/pom.xml b/jave-nativebin-win64/pom.xml index ce4b4f0..39b0b89 100644 --- a/jave-nativebin-win64/pom.xml +++ b/jave-nativebin-win64/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ws.schild jar - 2.6.0 + 2.6.1 jave-nativebin-win64 Jave windows 64 bit native package The JAVE (Java Audio Video Encoder) library is Java wrapper on the diff --git a/pom.xml b/pom.xml index de85e2a..53da043 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ jave-modules pom - 2.6.0 + 2.6.1 1.8 1.8 UTF-8 - 2.6.0 + 2.6.1 Jave master project Jave master project https://github.com/a-schild/jave2