Skip to content

Commit

Permalink
* Add to FFmpegFrameGrabber and FFmpegFrameRecorder constructors…
Browse files Browse the repository at this point in the history
… taking a `URL` for convenience and clarity

 * Upgrade dependencies for FFmpeg 5.0.1
  • Loading branch information
saudet committed Apr 29, 2022
1 parent d5943d7 commit 36dd5c2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

* Add to `FFmpegFrameGrabber` and `FFmpegFrameRecorder` constructors taking a `URL` for convenience and clarity
* Fix incorrect call to `opencv_calib3d.stereoRectify()` in `ProjectiveDevice` ([issue #1802](https://github.com/bytedeco/javacv/issues/1802))
* Retry after 10 ms when `av_read_frame()` returns `EAGAIN` in `FFmpegFrameGrabber.grabFrame()` ([issue #1784](https://github.com/bytedeco/javacv/issues/1784))
* Append `frame_rate=%d/%d` input parameter in `FFmpegFrameFilter` as required by `xfade` ([issue #1776](https://github.com/bytedeco/javacv/issues/1776))
* Update `FFmpegStreamingTimeout` sample to use `timeout` instead of `stimeout` for RTSP ([pull #1758](https://github.com/bytedeco/javacv/pull/1758))
* Restore static calls to `FFmpegFrameGrabber.tryLoad()` and `FFmpegFrameRecorder.tryLoad()` ([issue #1756](https://github.com/bytedeco/javacv/issues/1756))
* Enable by default on `RealSense2FrameGrabber.start()` all color, depth, and IR streams as `videoStream` ([pull #1750](https://github.com/bytedeco/javacv/pull/1750))
* Upgrade dependencies for OpenBLAS 0.3.20, Leptonica 1.82.0 ([pull #1791](https://github.com/bytedeco/javacv/pull/1791)), Tesseract 5.1.0
* Upgrade dependencies for OpenBLAS 0.3.20, FFmpeg 5.0.1, Leptonica 1.82.0 ([pull #1791](https://github.com/bytedeco/javacv/pull/1791)), Tesseract 5.1.0

### February 11, 2022 version 1.5.7
* Fix accuracy and latency issues with `FFmpegFrameGrabber.setVideoFrameNumber()` ([pull #1734](https://github.com/bytedeco/javacv/pull/1734))
Expand Down
2 changes: 1 addition & 1 deletion platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>5.0-${javacpp.version}</version>
<version>5.0.1-${javacpp.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void testFFmpegFrameGrabber() {
clone2.close();
}
long stopTime = System.nanoTime();
assertEquals(n, (stopTime - startTime) * grabber.getFrameRate() / 1_000_000_000, 2.0);
assertEquals(n, (stopTime - startTime) * grabber.getFrameRate() / 1_000_000_000, 3.0);
assertEquals(frames.length, n);
assertEquals(null, grabber.grab());
grabber.restart();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg</artifactId>
<version>5.0-${javacpp.version}</version>
<version>5.0.1-${javacpp.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.Collections;
Expand Down Expand Up @@ -138,6 +139,9 @@ public static void tryLoad() throws Exception {
} catch (Exception ex) { }
}

public FFmpegFrameGrabber(URL url) {
this(url.toString());
}
public FFmpegFrameGrabber(File file) {
this(file.getAbsolutePath());
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down Expand Up @@ -139,18 +140,27 @@ public static void tryLoad() throws Exception {
} catch (Exception ex) { }
}

public FFmpegFrameRecorder(URL url, int audioChannels) {
this(url.toString(), 0, 0, audioChannels);
}
public FFmpegFrameRecorder(File file, int audioChannels) {
this(file, 0, 0, audioChannels);
}
public FFmpegFrameRecorder(String filename, int audioChannels) {
this(filename, 0, 0, audioChannels);
}
public FFmpegFrameRecorder(URL url, int imageWidth, int imageHeight) {
this(url.toString(), imageWidth, imageHeight, 0);
}
public FFmpegFrameRecorder(File file, int imageWidth, int imageHeight) {
this(file, imageWidth, imageHeight, 0);
}
public FFmpegFrameRecorder(String filename, int imageWidth, int imageHeight) {
this(filename, imageWidth, imageHeight, 0);
}
public FFmpegFrameRecorder(URL url, int imageWidth, int imageHeight, int audioChannels) {
this(url.toString(), imageWidth, imageHeight, audioChannels);
}
public FFmpegFrameRecorder(File file, int imageWidth, int imageHeight, int audioChannels) {
this(file.getAbsolutePath(), imageWidth, imageHeight, audioChannels);
}
Expand Down

0 comments on commit 36dd5c2

Please sign in to comment.