Skip to content

Commit

Permalink
2.6.1 with support for default screenshot size images
Browse files Browse the repository at this point in the history
  • Loading branch information
a-schild committed Oct 15, 2019
1 parent 3783bf4 commit 232289d
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 57 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ It includes all binaries for the supported platforms
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-all-deps</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand All @@ -60,7 +60,7 @@ Generally if you want to use for one platform or more what you have to do is add
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand All @@ -71,7 +71,7 @@ and then the specific jar(s) for your platform(s) :
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand All @@ -80,7 +80,7 @@ and then the specific jar(s) for your platform(s) :
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand All @@ -89,7 +89,7 @@ and then the specific jar(s) for your platform(s) :
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-osx64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions jave-all-deps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-all-deps</artifactId>
<name>Jave all native dependencies package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
Expand Down Expand Up @@ -152,32 +152,32 @@
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-osx64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
Expand Down
14 changes: 7 additions & 7 deletions jave-core-test-java11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-core-test-java11</artifactId>
<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down Expand Up @@ -38,32 +38,32 @@
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-osx64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
Expand Down
14 changes: 7 additions & 7 deletions jave-core-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-core-test</artifactId>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -38,32 +38,32 @@
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-osx64</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion jave-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<name>Jave core package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
ffmpeg project. Developers can take take advantage of JAVE2 to transcode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
36 changes: 20 additions & 16 deletions jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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())
Expand All @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions jave-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-example</artifactId>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -66,12 +66,12 @@
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux32</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion jave-nativebin-linux32/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-nativebin-linux32</artifactId>
<name>Jave linux 32 bit native package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
Expand Down
2 changes: 1 addition & 1 deletion jave-nativebin-linux64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-nativebin-linux64</artifactId>
<name>Jave linux 64 bit native package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
Expand Down
2 changes: 1 addition & 1 deletion jave-nativebin-osx64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-nativebin-osx64</artifactId>
<name>Jave OSX 64 bit native package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
Expand Down
2 changes: 1 addition & 1 deletion jave-nativebin-win32/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-nativebin-win32</artifactId>
<name>Jave windows 32 bit native package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
Expand Down
2 changes: 1 addition & 1 deletion jave-nativebin-win64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ws.schild</groupId>
<packaging>jar</packaging>
<version>2.6.0</version>
<version>2.6.1</version>
<artifactId>jave-nativebin-win64</artifactId>
<name>Jave windows 64 bit native package</name>
<description>The JAVE (Java Audio Video Encoder) library is Java wrapper on the
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<artifactId>jave-modules</artifactId>
<packaging>pom</packaging>
<properties>
<revision>2.6.0</revision>
<revision>2.6.1</revision>
<!-- Don't forget to change it also in DefaultFFMPEGLocator.java -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<version>2.6.0</version>
<version>2.6.1</version>
<name>Jave master project</name>
<description>Jave master project</description>
<url>https://github.com/a-schild/jave2</url>
Expand Down

0 comments on commit 232289d

Please sign in to comment.