Java interface to OpenCV, FFmpeg, and more

Overview

JavaCV

Gitter Maven Central Sonatype Nexus (Snapshots) Build Status Commercial support: xscode

Introduction

JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of computer vision (OpenCV, FFmpeg, libdc1394, FlyCapture, Spinnaker, OpenKinect, librealsense, CL PS3 Eye Driver, videoInput, ARToolKitPlus, flandmark, Leptonica, and Tesseract) and provides utility classes to make their functionality easier to use on the Java platform, including Android.

JavaCV also comes with hardware accelerated full-screen image display (CanvasFrame and GLCanvasFrame), easy-to-use methods to execute code in parallel on multiple cores (Parallel), user-friendly geometric and color calibration of cameras and projectors (GeometricCalibrator, ProCamGeometricCalibrator, ProCamColorCalibrator), detection and matching of feature points (ObjectFinder), a set of classes that implement direct image alignment of projector-camera systems (mainly GNImageAligner, ProjectiveTransformer, ProjectiveColorTransformer, ProCamTransformer, and ReflectanceInitializer), a blob analysis package (Blobs), as well as miscellaneous functionality in the JavaCV class. Some of these classes also have an OpenCL and OpenGL counterpart, their names ending with CL or starting with GL, i.e.: JavaCVCL, GLCanvasFrame, etc.

To learn how to use the API, since documentation currently lacks, please refer to the Sample Usage section below as well as the sample programs, including two for Android (FacePreview.java and RecordActivity.java), also found in the samples directory. You may also find it useful to refer to the source code of ProCamCalib and ProCamTracker as well as examples ported from OpenCV2 Cookbook and the associated wiki pages.

Please keep me informed of any updates or fixes you make to the code so that I may integrate them into the next release. Thank you! And feel free to ask questions on the mailing list or the discussion forum if you encounter any problems with the software! I am sure it is far from perfect...

Downloads

Archives containing JAR files are available as releases. The binary archive contains builds for Android, iOS, Linux, Mac OS X, and Windows. The JAR files for specific child modules or platforms can also be obtained individually from the Maven Central Repository.

To install manually the JAR files, follow the instructions in the Manual Installation section below.

We can also have everything downloaded and installed automatically with:

  • Maven (inside the pom.xml file)
  <dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv-platform</artifactId>
    <version>1.5.5</version>
  </dependency>
  • Gradle (inside the build.gradle file)
  dependencies {
    implementation group: 'org.bytedeco', name: 'javacv-platform', version: '1.5.5'
  }
  • Leiningen (inside the project.clj file)
  :dependencies [
    [org.bytedeco/javacv-platform "1.5.5"]
  ]
  • sbt (inside the build.sbt file)
  libraryDependencies += "org.bytedeco" % "javacv-platform" % "1.5.5"

This downloads binaries for all platforms, but to get binaries for only one platform we can set the javacpp.platform system property (via the -D command line option) to something like android-arm, linux-x86_64, macosx-x86_64, windows-x86_64, etc. Please refer to the README.md file of the JavaCPP Presets for details. Another option available to Gradle users is Gradle JavaCPP, and similarly for Scala users there is SBT-JavaCV.

Required Software

To use JavaCV, you will first need to download and install the following software:

Further, although not always required, some functionality of JavaCV also relies on:

Finally, please make sure everything has the same bitness: 32-bit and 64-bit modules do not mix under any circumstances.

Manual Installation

Simply put all the desired JAR files (opencv*.jar, ffmpeg*.jar, etc.), in addition to javacpp.jar and javacv.jar, somewhere in your class path. Here are some more specific instructions for common cases:

NetBeans (Java SE 7 or newer):

  1. In the Projects window, right-click the Libraries node of your project, and select "Add JAR/Folder...".
  2. Locate the JAR files, select them, and click OK.

Eclipse (Java SE 7 or newer):

  1. Navigate to Project > Properties > Java Build Path > Libraries and click "Add External JARs...".
  2. Locate the JAR files, select them, and click OK.

IntelliJ IDEA (Android 5.0 or newer):

  1. Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/
  2. Copy all the JAR files into the app/libs subdirectory.
  3. Navigate to File > Project Structure > app > Dependencies, click +, and select "2 File dependency".
  4. Select all the JAR files from the libs subdirectory.

After that, the wrapper classes for OpenCV and FFmpeg, for example, can automatically access all of their C/C++ APIs:

Sample Usage

The class definitions are basically ports to Java of the original header files in C/C++, and I deliberately decided to keep as much of the original syntax as possible. For example, here is a method that tries to load an image file, smooth it, and save it back to disk:

import org.bytedeco.opencv.opencv_core.*;
import org.bytedeco.opencv.opencv_imgproc.*;
import static org.bytedeco.opencv.global.opencv_core.*;
import static org.bytedeco.opencv.global.opencv_imgproc.*;
import static org.bytedeco.opencv.global.opencv_imgcodecs.*;

public class Smoother {
    public static void smooth(String filename) {
        Mat image = imread(filename);
        if (image != null) {
            GaussianBlur(image, image, new Size(3, 3), 0);
            imwrite(filename, image);
        }
    }
}

JavaCV also comes with helper classes and methods on top of OpenCV and FFmpeg to facilitate their integration to the Java platform. Here is a small demo program demonstrating the most frequently useful parts:

import java.io.File;
import java.net.URL;
import org.bytedeco.javacv.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.indexer.*;
import org.bytedeco.opencv.opencv_core.*;
import org.bytedeco.opencv.opencv_imgproc.*;
import org.bytedeco.opencv.opencv_calib3d.*;
import org.bytedeco.opencv.opencv_objdetect.*;
import static org.bytedeco.opencv.global.opencv_core.*;
import static org.bytedeco.opencv.global.opencv_imgproc.*;
import static org.bytedeco.opencv.global.opencv_calib3d.*;
import static org.bytedeco.opencv.global.opencv_objdetect.*;

public class Demo {
    public static void main(String[] args) throws Exception {
        String classifierName = null;
        if (args.length > 0) {
            classifierName = args[0];
        } else {
            URL url = new URL("https://raw.github.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_alt.xml");
            File file = Loader.cacheResource(url);
            classifierName = file.getAbsolutePath();
        }

        // We can "cast" Pointer objects by instantiating a new object of the desired class.
        CascadeClassifier classifier = new CascadeClassifier(classifierName);
        if (classifier == null) {
            System.err.println("Error loading classifier file \"" + classifierName + "\".");
            System.exit(1);
        }

        // The available FrameGrabber classes include OpenCVFrameGrabber (opencv_videoio),
        // DC1394FrameGrabber, FlyCapture2FrameGrabber, OpenKinectFrameGrabber, OpenKinect2FrameGrabber,
        // RealSenseFrameGrabber, RealSense2FrameGrabber, PS3EyeFrameGrabber, VideoInputFrameGrabber, and FFmpegFrameGrabber.
        FrameGrabber grabber = FrameGrabber.createDefault(0);
        grabber.start();

        // CanvasFrame, FrameGrabber, and FrameRecorder use Frame objects to communicate image data.
        // We need a FrameConverter to interface with other APIs (Android, Java 2D, JavaFX, Tesseract, OpenCV, etc).
        OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat();

        // FAQ about IplImage and Mat objects from OpenCV:
        // - For custom raw processing of data, createBuffer() returns an NIO direct
        //   buffer wrapped around the memory pointed by imageData, and under Android we can
        //   also use that Buffer with Bitmap.copyPixelsFromBuffer() and copyPixelsToBuffer().
        // - To get a BufferedImage from an IplImage, or vice versa, we can chain calls to
        //   Java2DFrameConverter and OpenCVFrameConverter, one after the other.
        // - Java2DFrameConverter also has static copy() methods that we can use to transfer
        //   data more directly between BufferedImage and IplImage or Mat via Frame objects.
        Mat grabbedImage = converter.convert(grabber.grab());
        int height = grabbedImage.rows();
        int width = grabbedImage.cols();

        // Objects allocated with `new`, clone(), or a create*() factory method are automatically released
        // by the garbage collector, but may still be explicitly released by calling deallocate().
        // You shall NOT call cvReleaseImage(), cvReleaseMemStorage(), etc. on objects allocated this way.
        Mat grayImage = new Mat(height, width, CV_8UC1);
        Mat rotatedImage = grabbedImage.clone();

        // The OpenCVFrameRecorder class simply uses the VideoWriter of opencv_videoio,
        // but FFmpegFrameRecorder also exists as a more versatile alternative.
        FrameRecorder recorder = FrameRecorder.createDefault("output.avi", width, height);
        recorder.start();

        // CanvasFrame is a JFrame containing a Canvas component, which is hardware accelerated.
        // It can also switch into full-screen mode when called with a screenNumber.
        // We should also specify the relative monitor/camera response for proper gamma correction.
        CanvasFrame frame = new CanvasFrame("Some Title", CanvasFrame.getDefaultGamma()/grabber.getGamma());

        // Let's create some random 3D rotation...
        Mat randomR    = new Mat(3, 3, CV_64FC1),
            randomAxis = new Mat(3, 1, CV_64FC1);
        // We can easily and efficiently access the elements of matrices and images
        // through an Indexer object with the set of get() and put() methods.
        DoubleIndexer Ridx = randomR.createIndexer(),
                   axisIdx = randomAxis.createIndexer();
        axisIdx.put(0, (Math.random() - 0.5) / 4,
                       (Math.random() - 0.5) / 4,
                       (Math.random() - 0.5) / 4);
        Rodrigues(randomAxis, randomR);
        double f = (width + height) / 2.0;  Ridx.put(0, 2, Ridx.get(0, 2) * f);
                                            Ridx.put(1, 2, Ridx.get(1, 2) * f);
        Ridx.put(2, 0, Ridx.get(2, 0) / f); Ridx.put(2, 1, Ridx.get(2, 1) / f);
        System.out.println(Ridx);

        // We can allocate native arrays using constructors taking an integer as argument.
        Point hatPoints = new Point(3);

        while (frame.isVisible() && (grabbedImage = converter.convert(grabber.grab())) != null) {
            // Let's try to detect some faces! but we need a grayscale image...
            cvtColor(grabbedImage, grayImage, CV_BGR2GRAY);
            RectVector faces = new RectVector();
            classifier.detectMultiScale(grayImage, faces);
            long total = faces.size();
            for (long i = 0; i < total; i++) {
                Rect r = faces.get(i);
                int x = r.x(), y = r.y(), w = r.width(), h = r.height();
                rectangle(grabbedImage, new Point(x, y), new Point(x + w, y + h), Scalar.RED, 1, CV_AA, 0);

                // To access or pass as argument the elements of a native array, call position() before.
                hatPoints.position(0).x(x - w / 10     ).y(y - h / 10);
                hatPoints.position(1).x(x + w * 11 / 10).y(y - h / 10);
                hatPoints.position(2).x(x + w / 2      ).y(y - h / 2 );
                fillConvexPoly(grabbedImage, hatPoints.position(0), 3, Scalar.GREEN, CV_AA, 0);
            }

            // Let's find some contours! but first some thresholding...
            threshold(grayImage, grayImage, 64, 255, CV_THRESH_BINARY);

            // To check if an output argument is null we may call either isNull() or equals(null).
            MatVector contours = new MatVector();
            findContours(grayImage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
            long n = contours.size();
            for (long i = 0; i < n; i++) {
                Mat contour = contours.get(i);
                Mat points = new Mat();
                approxPolyDP(contour, points, arcLength(contour, true) * 0.02, true);
                drawContours(grabbedImage, new MatVector(points), -1, Scalar.BLUE);
            }

            warpPerspective(grabbedImage, rotatedImage, randomR, rotatedImage.size());

            Frame rotatedFrame = converter.convert(rotatedImage);
            frame.showImage(rotatedFrame);
            recorder.record(rotatedFrame);
        }
        frame.dispose();
        recorder.stop();
        grabber.stop();
    }
}

Furthermore, after creating a pom.xml file with the following content:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.bytedeco.javacv</groupId>
    <artifactId>demo</artifactId>
    <version>1.5.5</version>
    <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacv-platform</artifactId>
            <version>1.5.5</version>
        </dependency>

        <!-- Additional dependencies required to use CUDA and cuDNN -->
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>opencv-platform-gpu</artifactId>
            <version>4.5.1-1.5.5</version>
        </dependency>

        <!-- Optional GPL builds with (almost) everything enabled -->
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>ffmpeg-platform-gpl</artifactId>
            <version>4.3.2-1.5.5</version>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>.</sourceDirectory>
    </build>
</project>

And by placing the source code above in Demo.java, or similarly for other classes found in the samples, we can use the following command to have everything first installed automatically and then executed by Maven:

 $ mvn compile exec:java -Dexec.mainClass=Demo

Note: In case of errors, please make sure that the artifactId in the pom.xml file reads javacv-platform, not javacv only, for example. The artifact javacv-platform adds all the necessary binary dependencies.

Build Instructions

If the binary files available above are not enough for your needs, you might need to rebuild them from the source code. To this end, the project files were created for:

Once installed, simply call the usual mvn install command for JavaCPP, its Presets, and JavaCV. By default, no other dependencies than a C++ compiler for JavaCPP are required. Please refer to the comments inside the pom.xml files for further details.

Instead of building the native libraries manually, we can run mvn install for JavaCV only and rely on the snapshot artifacts from the CI builds:


Project lead: Samuel Audet samuel.audet at gmail.com
Developer site: https://github.com/bytedeco/javacv
Discussion group: http://groups.google.com/group/javacv

Comments
  • Right way to implement overlay filter

    Right way to implement overlay filter

    I'm currently working on adding an overlay image on top of the video. It is clear, how to do it on bare FFMpeg, but what is the right way to provide an image for the FFMpegFrameFilter for an overlay filter? Is it possible to write there -i path/to/img.jpg -filter_complex "[0][1]overlay"? Or there is another way? And what is the shortcut for a video stream (0 or 1 in this case)?

    I know, that it sounds more like a StackOverflow question but it looks like it is impossible to get a reply on a JavaCV topic there

    bug 
    opened by DeKinci 111
  • java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil in Marshmallow

    java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil in Marshmallow

    mFrameRecorder = new FFmpegFrameRecorder(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath() + File.separator + "new.mp4", 480, 480, 1);
    

    crash happened in this code after i update my nexus5 to Marshmallow,and it works fine before.And the error log below:

    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: FATAL EXCEPTION: main
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: Process: com.beak.petsfbi, PID: 22095
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.Class.forName(Class.java:324)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.Loader.load(Loader.java:390)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.Loader.load(Loader.java:358)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1407)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.beak.petsfbi.activity.VideoRecorderActivity.startRecord(VideoRecorderActivity.java:177)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.beak.petsfbi.activity.VideoRecorderActivity$1.onClick(VideoRecorderActivity.java:57)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.view.View.performClick(View.java:5198)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.view.View$PerformClick.run(View.java:21147)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:739)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:95)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    
    bug 
    opened by boybeak 59
  • FFmpegFrameRecorder setVideoFilter - transpose or passthrough

    FFmpegFrameRecorder setVideoFilter - transpose or passthrough

    Is there a way to set transpose=dir=1:passthrough=portrait filters using FFmpegFrameRecorder.setVideoOption? I'm trying to rotate the video recorded to portrait. Saudet once said what can be done in command line tool "ffmpeg" can be done with FFmpegFrameRecorder, but I cant get the video to rotate. I'm using RTMP link in the recorder URL. Thank you, Tomer

    enhancement help wanted question 
    opened by tomerhatav 58
  • Very High Latency with FFmpegFrameGrabber.setVideoFrameNumber(lastFrame)

    Very High Latency with FFmpegFrameGrabber.setVideoFrameNumber(lastFrame)

    I am trying to grab the last frame of a video and when I set the video frame number to the last frame, it has to a really huge latency.

    2021-09-08 12:18:02.154 [main] INFO VideoFrameExtractor#getBufferedImageWithSize() - Latency for setVideoFrameNumber = 123689 ms

    try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(mediaFile)) {
        frameGrabber.startUnsafe();
        int lastFrameIndex = frameGrabber.getLengthInVideoFrames() - 1;
        frameGrabber.setVideoFrameNumber(lastFrameIndex);
        Frame frame = frameGrabber.grabImage();
        frameGrabber.releaseUnsafe();
    } catch(Exception e) {
        log.error("Failed to extract FrameImages");
    }
    

    The problematic video: https://gcdn.2mdn.net/videoplayback/id/75efee055f336ba7/itag/15/source/doubleclick_dmm/ctier/L/ip/0.0.0.0/ipbits/0/expire/3764707174/sparams/id,itag,source,ctier,ip,ipbits,expire/signature/B6C6DC0D594223A684DA84FEB4235A503AFA5DD1.A007DA81FEF13E870A626B4F3967237959BF8561/key/ck2/file/file.mov

    I am currently using version 1.5 but I have also tried it latest version 1.5.6, it still doesn't work. Can someone help me debug this issue.

    ffprobe file.mov -show_streams  -select_streams v  -print_format json
    ffprobe version 4.3.2 Copyright (c) 2007-2021 the FFmpeg developers
      built with Apple clang version 12.0.0 (clang-1200.0.32.29)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
      libavutil      56. 51.100 / 56. 51.100
      libavcodec     58. 91.100 / 58. 91.100
      libavformat    58. 45.100 / 58. 45.100
      libavdevice    58. 10.100 / 58. 10.100
      libavfilter     7. 85.100 /  7. 85.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  7.100 /  5.  7.100
      libswresample   3.  7.100 /  3.  7.100
      libpostproc    55.  7.100 / 55.  7.100
    {
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mov':
      Metadata:
        major_brand     : qt
        minor_version   : 537134592
        compatible_brands: qt
        creation_time   : 2021-05-05T11:30:45.000000Z
        com.apple.quicktime.software: Telestream Media Framework - Main 2018.5814.0x0b6fd52e
        timecode        : 01:00:00:00
      Duration: 00:00:30.03, start: 0.000000, bitrate: 31202 kb/s
        Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 31001 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
        Metadata:
          encoder         : AVC
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
        Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
        Metadata:
          handler_name    : Time Code Media Handler
          timecode        : 01:00:00:00
    Unsupported codec with id 0 for input stream 2
        "streams": [
            {
                "index": 0,
                "codec_name": "h264",
                "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
                "profile": "Main",
                "codec_type": "video",
                "codec_time_base": "1001/48000",
                "codec_tag_string": "avc1",
                "codec_tag": "0x31637661",
                "width": 1920,
                "height": 1080,
                "coded_width": 1920,
                "coded_height": 1088,
                "closed_captions": 0,
                "has_b_frames": 1,
                "sample_aspect_ratio": "1:1",
                "display_aspect_ratio": "16:9",
                "pix_fmt": "yuv420p",
                "level": 50,
                "color_range": "tv",
                "color_space": "bt709",
                "color_transfer": "bt709",
                "color_primaries": "bt709",
                "chroma_location": "left",
                "field_order": "progressive",
                "refs": 1,
                "is_avc": "true",
                "nal_length_size": "4",
                "r_frame_rate": "24000/1001",
                "avg_frame_rate": "24000/1001",
                "time_base": "1/24000",
                "start_pts": 0,
                "start_time": "0.000000",
                "duration_ts": 720720,
                "duration": "30.030000",
                "bit_rate": "31001075",
                "bits_per_raw_sample": "8",
                "nb_frames": "720",
                "disposition": {
                    "default": 1,
                    "dub": 0,
                    "original": 0,
                    "comment": 0,
                    "lyrics": 0,
                    "karaoke": 0,
                    "forced": 0,
                    "hearing_impaired": 0,
                    "visual_impaired": 0,
                    "clean_effects": 0,
                    "attached_pic": 0,
                    "timed_thumbnails": 0
                },
                "tags": {
                    "encoder": "AVC"
                }
            }
        ]
    }
    
    question 
    opened by jainvijay 56
  • Maximising FFmpegFrameGrabber and FFmpegFrameRecorder performance

    Maximising FFmpegFrameGrabber and FFmpegFrameRecorder performance

    I'd like to know if there's anything I can do to make these run faster. With 4K videos, I don't even get real-time performance which would allow to play back the video normally (I get about 26 FPS for a 30 FPS video), when I throw in encoding, I get something between 6 FPS and 12 FPS, depending on params used.

    This is the code I use for testing:

    FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("in.mp4");
    grabber.start();
    
    FrameRecorder recorder = new FFmpegFrameRecorder("out.mp4", grabber.getImageWidth(), grabber.getImageHeight());
    recorder.setFormat(grabber.getFormat());
    recorder.setPixelFormat(AV_PIX_FMT_YUV420P);
    recorder.setFrameRate(grabber.getFrameRate());
    recorder.setVideoBitrate(grabber.getVideoBitrate());
    recorder.setVideoCodec(grabber.getVideoCodec());
    recorder.setVideoOption("preset", "ultrafast");
    recorder.setVideoCodecName("libx264");
    recorder.setVideoCodec(AV_CODEC_ID_H264);
    recorder.start();
    
    int frameCount = 0;
    long startTime = System.currentTimeMillis();
    
    Frame frame;
    while ((frame = grabber.grabFrame(false, true, true, false)) != null) {
        recorder.record(frame);
        ++frameCount;
    }
    
    float secs = (System.currentTimeMillis() - startTime) / 1000.0f;
    System.out.println("processing " + frameCount + " frames took " + (Math.round(secs * 1000) / 1000.0f) + " (" + (Math.round(frameCount / secs * 1000) / 1000.0f) + " fps)");
    

    Is there anything I can do to make things faster? Docs for this are next to non-existent, that's why I'm asking this here.

    I'm testing this on MacBook Pro 13" (MacBookPro14,1, Intel Core i7 2,5 GHz).

    enhancement 
    opened by b005t3r 56
  • Green / Yellow Color video after croping

    Green / Yellow Color video after croping

    I need to crop a video. Below are my Gradle dependencies:

    ext {
        versions = [
                'ffmpeg': '3.4.2-1.4.1'
        ]
    }
        implementation files('libs/javacv-platform-1.4.2-spanshot.jar')
        implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg
        implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg, 
    classifier: 'android-arm'
    

    Have tried with the following versions of javacv too:

    compile('org.bytedeco:javacv-platform:1.4.1') {   // and 1.3, 1.4 also
            exclude group: 'org.bytedeco.javacpp-presets'
        }
    

    Using [CrazyOrr project] (https://github.com/CrazyOrr/FFmpegRecorder/blob/master/app/src/main/java/com/github/crazyorr/ffmpegrecorder/FFmpegRecordActivity.java) as a sample.

    Reviewed following links but no luck: https://github.com/bytedeco/sample-projects/tree/master/javacv-android-camera-preview https://github.com/bytedeco/sample-projects/tree/master/javacv-android-recognize

    Have tried

    adding /removing : mFrameRecorder.setPixelFormat(avutil.AV_PIX_FMT_NV21); removing recorder.setPixelFormat() and adding push(frame, AV_PIX_FMT_NV21) did not work.

    Tried with following versions: 1.3, 1.4, 1.4.1, 1.4.2-SNAPSHOT

    duplicate question 
    opened by ritesh94 53
  • Exception in thread

    Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil

    hello! i am a working on a project using opencv and javacv in java using netbeans to extract frames from a video but i am getting the above mentioned error. i have already added the required opencv and javacv jar files. my code is something like this

    FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber("E:/background.mp4"); ImageIO.write((RenderedImage) frameGrabber.grabFrame(), "png", new File("E:/img" +frameNumber + ".png")); kindly help me thanks

    question 
    opened by tehseenmayar 53
  • OutOfMemoryException by FFMpegFrameGrabber

    OutOfMemoryException by FFMpegFrameGrabber

    We are using FFMpegFrameGrabber for creating thumbnails out of videos. We are facing OutOfMemoryException Like below.

    Can someone help us??

    . Thanks in advance.

    HTTP Status 500 - Handler processing failed; nested exception is java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes = 3G > maxPhysicalBytes = 3G type Exception report message Handler processing failed; nested exception is java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes = 3G > maxPhysicalBytes = 3G description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes = 3G > maxPhysicalBytes = 3G org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1287) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) javax.servlet.http.HttpServlet.service(HttpServlet.java:644) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:104) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54) org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root cause java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes = 3G > maxPhysicalBytes = 3G org.bytedeco.javacpp.Pointer.deallocator(Pointer.java:562) org.bytedeco.javacpp.Pointer.init(Pointer.java:121) org.bytedeco.javacpp.avcodec$AVPacket.allocate(Native Method) org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1696) org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:471) org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:462) org.bahmni.module.bahmnimsf.extension.PatientDocumentThumbnailGenerator.generateThumbnail(PatientDocumentThumbnailGenerator.java:40) org.bahmni.module.bahmnicore.service.impl.PatientDocumentServiceImpl.createAndSaveThumbnailForVideo(PatientDocumentServiceImpl.java:147) org.bahmni.module.bahmnicore.service.impl.PatientDocumentServiceImpl.saveDocumentInFile(PatientDocumentServiceImpl.java:116) org.bahmni.module.bahmnicore.service.impl.PatientDocumentServiceImpl.saveDocument(PatientDocumentServiceImpl.java:73) org.bahmni.module.bahmnicore.web.v1_0.controller.VisitDocumentController.saveDocument(VisitDocumentController.java:60) sun.reflect.GeneratedMethodAccessor1844.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) javax.servlet.http.HttpServlet.service(HttpServlet.java:644) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:104) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54) org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.12 logs. Apache Tomcat/8.0.12

    bug question 
    opened by maharjunm 50
  • Gradle Android presets only for old Arm & x86?

    Gradle Android presets only for old Arm & x86?

    ndk {
    	abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
    }
    
    dependencies {
    	...
    	compile('org.bytedeco:javacv-platform:1.3.3') { exclude group: 'org.bytedeco.javacpp-presets' }
    	compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm' // old armeabi
    	compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-x86' 
    

    What about presets for 'x86_64', 'armeabi-v7a', 'arm64-v8a'? So after compilation only armeabi & x86 folders have .so files (in app.apk/lib)

    I don't even want to support old armeabi (it should be at least armeabi-v7a)

    Do I have to compile libraries by myself? No predefined libraries for all modern architectures? How to do it?

    duplicate enhancement 
    opened by anonym24 48
  • Duplicated files copied in APK

    Duplicated files copied in APK

    After updating to gradle 2.10 I started getting the following error for opencv and ffmpeg:

    Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForCamioDebug'.
    > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties
        File1: /.../.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/opencv/2.4.10-0.10/a52a775a3d2d578823f86f1c9a347501bc39d9d2/opencv-2.4.10-0.10.jar
        File2: /.../.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/opencv/2.4.10-0.10/2c3aef96adc0bdc11519b79d26603716e8a961c3/opencv-2.4.10-0.10-android-arm.jar
    

    In order to ignore them, I used pickFirst to prevent duplication.

    packagingOptions {
        pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
        pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
        pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
        pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
    }
    

    Is this the right way to do it or some other approach is advisable?

    enhancement 
    opened by 3dm1 48
  • A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9200df0 in tid 15974 (.myapplication)

    A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9200df0 in tid 15974 (.myapplication)

    I am working on project for video frame extraction from video file and detect pupil in this frames and regenerate pupil detected frame video in android using opencv, javacv and javacpp,ffmpeg but when i run apk and after frame extraction using FFmpegFrameGrabber its crash my app and show below log.

     A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xfa600b88 in tid 27543 (Thread-60)
     A/libc: Invalid address 0xcadc5938 passed to free: value not allocated 
    
    

    please help me to solve this issue.

    Thanks in advance.

    question 
    opened by rudrandroid 44
  • Filter frame timestamp starts from 0 when dynamically changing the filter

    Filter frame timestamp starts from 0 when dynamically changing the filter

    1. I want to modify the filter dynamically. I find that the timestamp of the filter frame starts from 0 through the log;
    2. In addition, if a new rtmp input stream is dynamically added, the timestamp of this new input stream will also start from 0; What should I do to ensure that the timestamps of all frames are close to one second? Are there examples to provide ideas? thank you
    help wanted question 
    opened by libenli 5
  • java.lang.UnsatisfiedLinkError: no opencv_java460 in java.library.path

    java.lang.UnsatisfiedLinkError: no opencv_java460 in java.library.path

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java460 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at com.javaoffers.material.sample.MatSample.main(MatSample.java:21)

    help wanted question 
    opened by caomingjie-code 5
  • FFmpegFrameGrabber.load(myFile) .. start() crashes in Version 1.5.8 when using a filename with special characters

    FFmpegFrameGrabber.load(myFile) .. start() crashes in Version 1.5.8 when using a filename with special characters

    If i try to load a filename with special characters (excample: Mic Macs Raphael Beau 07 Ca déroule_44100_16_2.wav) my java program crashes without a comment. In version 1.5.7 all is fine. I use java 8.202 and I packaged the software with oracles's jpackager. When the software runs inside the IDE (Netbeans 8) everything works, but if I run the installed software on Windows 10 it crashes without a comment. If I do the same but using javacv_platform-1.5.7 all works fine.

    The crash occurs at the code sequence: FFmpegFrameGrabber myGrabber = FFmpegFrameGrabber.load(Mic Macs Raphael Beau 07 Ca déroule_44100_16_2.wav); myGrabber.start();

    bug help wanted 
    opened by HagiHagi 3
  • A jvm crash occurs after FFmpegFrameGrabber is used in docker

    A jvm crash occurs after FFmpegFrameGrabber is used in docker

    When I used FFmpegFrameGrabber normally to get video file information, I was fine, but when I containerized the service, using FFmpegFrameGrabber caused a jvm crash

    source code: public static String getVideoFps(File file){ log.info("打开ffmpeg"); FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(file); String result = ""; try { grabber.start(); Integer frameRate = (int) grabber.getVideoFrameRate(); result = String.valueOf(frameRate); grabber.stop(); }catch (Exception e){ } return result; }

    jvm crash when grabber.start();

    this is error:

    A fatal error has been detected by the Java Runtime Environment:

    SIGSEGV (0xb) at pc=0x000000000000dc56, pid=14, tid=0x00007f8218d22b38

    JRE version: OpenJDK Runtime Environment (8.0_302-b08) (build 1.8.0_302-b08)

    Java VM: OpenJDK 64-Bit Server VM (25.302-b08 mixed mode linux-amd64 compressed oops)

    Derivative: IcedTea 3.20.0

    Distribution: Custom build (Wed Oct 20 22:15:10 UTC 2021)

    Problematic frame:

    C 0x000000000000dc56

    Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

    An error report file with more information is saved as:

    java_error_9006.log

    If you would like to submit a bug report, please include

    instructions on how to reproduce the bug and visit:

    https://icedtea.classpath.org/bugzilla

    help wanted question 
    opened by mdzz0073 7
  • getLengthInVideoFrames's return value is not accurate frame count

    getLengthInVideoFrames's return value is not accurate frame count

    Hi, I'm using FFMpegFrameGrabber to a mp4 file , I use getLengthInvideoFrame after start method, and I get 2108 frames, But when I grab every video frames, totally only 2107 frames, the getLengthInvideoFrame returned is not the real frame count, How can I get the accurately frame count beore grab one by one? Thank you

    enhancement help wanted 
    opened by ggslayer 2
Releases(1.5.8)
  • 1.5.8(Nov 2, 2022)

    November 2, 2022 version 1.5.8

    • Override FFmpegFrameGrabber.getVideoCodecName()/getAudioCodecName() to return names of opened codecs (pull #1901)
    • Add FrameGrabber.videoDisposition/audioDisposition properties to select streams by disposition (pull #1879)
    • Work around OpenKinect2FrameGrabber failing when provided with a pipeline on some system (pull #1886)
    • Fix FFmpegFrameRecorder.record() incorrectly flushing the video codec on data frames (issue #1858)
    • Improve accuracy of FFmpegFrameGrabber.setFrameNumber() (pull #1851)
    • Add FrameGrabber.resetStartTime() to allow grabAtFrameRate() after operations such as seeking (pull #1846)
    • Add FrameGrabber.videoSideData/audioSideData properties and FFmpegFrameGrabber.getDisplayRotation() for convenience (issue #1361)
    • Add to FFmpegFrameGrabber and FFmpegFrameRecorder constructors taking a URL for convenience and clarity
    • Fix incorrect call to opencv_calib3d.stereoRectify() in ProjectiveDevice (issue #1802)
    • Retry after 10 ms when av_read_frame() returns EAGAIN in FFmpegFrameGrabber.grabFrame() (issue #1784)
    • Append frame_rate=%d/%d input parameter in FFmpegFrameFilter as required by xfade (issue #1776)
    • Update FFmpegStreamingTimeout sample to use timeout instead of stimeout for RTSP (pull #1758)
    • Restore static calls to FFmpegFrameGrabber.tryLoad() and FFmpegFrameRecorder.tryLoad() (issue #1756)
    • Enable by default on RealSense2FrameGrabber.start() all color, depth, and IR streams as videoStream (pull #1750)
    • Upgrade dependencies for OpenBLAS 0.3.21, OpenCV 4.6.0, FFmpeg 5.1.2, Leptonica 1.82.0 (pull #1791), Tesseract 5.2.0
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.8-bin.zip(871.66 MB)
    javacv-platform-1.5.8-src.zip(619.21 KB)
  • 1.5.7(Feb 10, 2022)

    February 11, 2022 version 1.5.7

    • Fix accuracy and latency issues with FFmpegFrameGrabber.setVideoFrameNumber() (pull #1734)
    • Add new Frame.pictType field set to I, P, B, etc by FFmpegFrameGrabber (pull #1730)
    • Set metadata for AVFrame.opaque in FFmpegFrameGrabber with call to av_frame_copy_props() (issue #1729)
    • Add charset property to FrameGrabber and FrameRecorder to use for metadata from FFmpeg (pull #1720)
    • Call Frame.close() on temporary clones in Java2DFrameUtils to prevent premature deallocations (issue #1716)
    • Ignore errors from avcodec_send_packet() and avcodec_receive_frame() to emulate old API in FFmpegFrameGrabber (issue #1679)
    • Upgrade dependencies for OpenBLAS 0.3.19, OpenCV 4.5.5, FFmpeg 5.0, librealsense2 2.50.0, Leptonica 1.82.0, Tesseract 5.0.1
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.7-bin.zip(815.62 MB)
    javacv-platform-1.5.7-src.zip(617.12 KB)
  • 1.5.6(Aug 2, 2021)

    August 2, 2021 version 1.5.6

    • Enhance audio and video synchronization of JavaFxPlayVideoAndAudio sample (pull #1662)
    • Add FrameGrabber.grabAtFrameRate() to simulate a device or stream when reading from files (pull #1659)
    • Update FFmpegFrameGrabber and FFmpegFrameRecorder with new avcodec API (issue #1498)
    • Add new Similarity sample with PSNR and MSSIM (pull #1622)
    • Avoid crash in FFmpegFrameRecorder.stop() by moving av_write_trailer() out of flush() (issue #1616)
    • Upgrade dependencies for OpenBLAS 0.3.17, OpenCV 4.5.3, FFmpeg 4.4, librealsense2 2.44.0, Leptonica 1.81.1
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.6-bin.zip(768.85 MB)
    javacv-platform-1.5.6-src.zip(618.24 KB)
  • 1.5.5(Mar 8, 2021)

    March 8, 2021 version 1.5.5

    • Have Frame and FrameConverter implement AutoCloseable to release memory explicitly (issue #1574)
    • Add new YOLONet sample for object detection (pull #1595)
    • Fix crash on FFmpegFrameGrabber.stop() when in ImageMode.RAW (issue #1568)
    • Let FFmpegFrameRecorder.flush() ignore errors from the encoder (issue #1563)
    • Improve FFmpegFrameGrabber.setTimestamp() and fix getAudioFrameRate() (pull #1559)
    • Fix frame rate and aspect ratio on FFmpegFrameRecorder.start(AVFormatContext) (pull #1535)
    • Upgrade dependencies for OpenBLAS 0.3.13, OpenCV 4.5.1, FFmpeg 4.3.2, librealsense2 2.40.0
    • Update unit tests to use codecs available in FFmpeg under LGPL v3 (pull bytedeco/javacpp-presets#950)
    • Add RealSense2FrameGrabber.tryLoad() method and missing entries for librealsense2 (issue bytedeco/procamcalib#25)
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.5-bin.zip(757.66 MB)
    javacv-platform-1.5.5-src.zip(613.90 KB)
  • 1.5.4(Sep 9, 2020)

    September 9, 2020 version 1.5.4

    • Fix error message thrown from FFmpegFrameRecorder.start() not containing filename (pull #1492)
    • Fix FFmpegFrameFilter.pull() not returning audio/video frames without audio/video filtergraph (issue #1466)
    • Update OpenCVFrameConverter.convertToOrgOpenCvCoreMat() with new API to set the stride (issue #1460)
    • Fix memory leaks and reduce memory fragmentation in FFmpegFrameGrabber and FFmpegFrameRecorder (issue #1366)
    • Use PointerScope in FFmpegFrameFilter, FFmpegFrameGrabber, and FFmpegFrameRecorder to deallocate quickly temporary buffers (issue #1383)
    • Fix FFmpegFrameFilter by calling String.format() with Locale.ROOT (pull #1441)
    • Increase thread safety of FFmpegFrameFilter, FFmpegFrameGrabber, and FFmpegFrameRecorder with synchronized methods (issue #1434)
    • Upgrade dependencies for OpenBLAS 0.3.10, OpenCV 4.4.0, FFmpeg 4.3.1, and Leptonica 1.80.0
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.4-bin.zip(754.57 MB)
    javacv-platform-1.5.4-src.zip(607.95 KB)
  • 1.5.3(Apr 14, 2020)

    April 14, 2020 version 1.5.3

    • Add FFmpegFrameGrabber.start(boolean findStreamInfo) parameter to minimize startup time (issue #1376)
    • Let FFmpegFrameGrabber.grab() return non-audio/video streams as new Frame.DATA type (pull #1378)
    • Fix crash in FFmpegFrameRecorder.flush() for HLS format and possibly others (pull #1374)
    • Fix "Resetting to invalid mark" IOException thrown on FFmpegFrameGrabber.release() (issue #911)
    • Upgrade dependencies for OpenBLAS 0.3.9, OpenCV 4.3.0, FFmpeg 4.2.2, Leptonica 1.79.0, and Tesseract 4.1.1
    • Add Seekable and SeekableByteArrayOutputStream to be used with FFmpegFrameRecorder (pull #1350)
    • Update RealSense2FrameGrabber with support for sensor options and fix for multiple devices (pull #1348)
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.3-bin.zip(737.64 MB)
    javacv-platform-1.5.3-src.zip(607.21 KB)
  • 1.5.2(Nov 5, 2019)

    November 5, 2019 version 1.5.2

    • Increase thread safety of FFmpegFrameFilter, FFmpegFrameGrabber, and FFmpegFrameRecorder with volatile boolean started flag (pull #1325)
    • Let FFmpegFrameFilter.push(null) indicate EOF to audio filters as well (issue #1315)
    • Add RealSense2FrameGrabber to capture images with librealsense2 (pull #1316)
    • Disable seek function in FFmpegFrameGrabber when maximumSize <= 0 (issue #1304)
    • Use Pointer.retainReference() to prevent PointerScope from deallocating globally shared callback objects for FFmpeg
    • Fix FFmpegFrameRecorder failing to encode float samples in MP3 (issue #1294)
    • Fix OpenCVFrameConverter error in IPCameraFrameGrabber (pull #1278)
    • Allow setting properties for OpenCVFrameGrabber and OpenCVFrameRecorder with setOption() (issue #1269)
    • Add missing requires java.desktop to module-info.java (issue #1265)
    • Upgrade dependencies for OpenBLAS 0.3.7, OpenCV 4.1.2, FFmpeg 4.2.1, librealsense 1.12.4, and librealsense2 2.29.0
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.2-bin.zip(673.96 MB)
    javacv-platform-1.5.2-src.zip(601.08 KB)
  • 1.5.1(Jul 9, 2019)

    July 9, 2019 version 1.5.1

    • Work around swscale bug in FFmpegFrameGrabber for images with unaligned width (issue #845)
    • Add support for AVSEEK_SIZE to FFmpegFrameGrabber as required by MPEG-TS (issue #1234)
    • Throw exception on start() for already started FFmpegFrameFilter, FFmpegFrameGrabber, or FFmpegFrameRecorder (issue #1233)
    • Add dependency on OpenBLAS/MKL, now used by OpenCV to accelerate some matrix operations
    • Upgrade dependencies for OpenCV 4.1.0, libdc1394 2.2.6, and Tesseract 4.1.0
    • Add support for Frame.timestamp to FFmpegFrameFilter (issue #1177)
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5.1-bin.zip(600.45 MB)
    javacv-platform-1.5.1-src.zip(589.88 KB)
  • 1.5(Apr 10, 2019)

    April 11, 2019 version 1.5

    • Override methods in FFmpegFrameGrabber to get all metadata from streams (issue #1180)
    • Fix sample rate in output of FFmpegFrameRecorder by setting deprecated AVStream.codec.time_base (issue #1179)
    • Add asetpts=N to input of FFmpegFrameFilter to make filters like afade behave as expected (issue #1171)
    • Use AVFormat.format() from Frame.opaque when available in FFmpegFrameFilter and FFmpegFrameRecorder (issue #1173)
    • Enable multithreading for all codecs by default in FFmpegFrameGrabber and FFmpegFrameRecorder (issue #1163)
    • Improve thread safety of FFmpegFrameRecorder and Java2DFrameConverter by relying less on Buffer.position (pull #1166)
    • Use ModiTect to compile module-info.java with JDK 8 and preserve backward compatibility
    • Add FFmpegFrameRecorder.closeOutputStream and FFmpegFrameGrabber.closeInputStream properties to leave streams opened (issue #1149)
    • Add FFmpegFrameRecorder.flush() method that does not release the stream (issue #1149)
    • Readd synchronized blocks for FFmpegFrameGrabber and FFmpegFrameRecorder, but make unsafe methods public (issue #1139)
    • Allocate native memory for Frame using Pointer to allow deallocation with PointerScope (issue #1152)
    • Add module-info.java and depend on modularized JavaCPP Presets to comply with JPMS
    • Upgrade dependencies for FFmpeg 4.1.3, libfreenect 0.5.7, and Leptonica 1.78.0
    • Allow allocation of Frame images with custom strides
    • Take into account Bitmap.getRowBytes() in AndroidFrameConverter.convert(Bitmap) (issue #1143)
    • Add static { Loader.load(); } in LeptonicaFrameConverter and OpenCVFrameConverter to prevent link errors (issue #1128)
    Source code(tar.gz)
    Source code(zip)
    javacv-platform-1.5-bin.zip(474.88 MB)
    javacv-platform-1.5-src.zip(589.14 KB)
Owner
Bytedeco
Bringing compute-intensive science, multimedia, computer vision, deep learning, etc to the Java platform
Bytedeco
Pixeed is an javafx, opencv based photo editing software which is enriched with functionalities listed below.

⭐⭐⭐⭐First Runner Up: ⭐⭐⭐⭐ The only team to dare to take upon themselves the task to make an image editor from scratch. Although it might not be a match for its ubiquitous contemporaries, it has all its basic features covered and easily accessible for even a new user.

Viraj 4 Apr 11, 2022
Traditional roguelike game with pixel-art graphics and simple interface

Traditional roguelike game with pixel-art graphics and simple interface

Evan Debenham 2.4k Nov 30, 2022
Fast computer vision library for SFM, calibration, fiducials, tracking, image processing, and more.

Table of Contents Introduction Cloning Repository Quick Start Gradle and Maven Building from Source Dependencies Help/Contact Introduction BoofCV is a

Peter Abeles 909 Dec 6, 2022
Pw0 Framewrok - magical android pentest app 🔮! Pixie Dust, Handshakes, Deauth, Nmap, Port scanner and more!

Pw0 Framework Pw0 Framewrok - magical android pentest app ?? ! Features: Pixie Dust Handshakes Deauth Nmap Port scanner and more! Version: 0.2 Beta Au

Huntmix 17 Sep 27, 2021
Roman Beskrovnyi 245 Nov 18, 2022
Anthos Edge Use Cases for bringing apps and computation closer to the location where the action is, to improve response times and save bandwidth.

Anthos Bare Metal Edge Use Cases Edge computing is a distributed computing paradigm that brings computation and data storage closer to the location wh

Google Cloud Platform 26 Dec 2, 2022
TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO

About TwelveMonkeys ImageIO is a collection of plugins and extensions for Java's ImageIO. These plugins extend the number of image file formats suppor

Harald Kuhr 1.5k Dec 3, 2022
This project allows the exchange of files between your local disk and a D64 image (Commodore 64 image disk) . Ce projet permet l'échange de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64).

DiskToolC64 Ce projet permet l'échange de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64). Introduction Les fi

Eddy BRIERE 3 Oct 12, 2022
A well-designed local image and video selector for Android

Matisse Matisse is a well-designed local image and video selector for Android. You can Use it in Activity or Fragment Select images including JPEG, PN

Zhihu 12.4k Dec 8, 2022
Provide image storage and access services.

Provide image storage and access services.

shiyq 2 Jan 23, 2022
Million+ point universal gravity simulation using OpenGL and OpenCL

Universe Simulation on GPU A multi-million particle gravity simulation. The main program is org.davu.app.Space.main See each package.html for code det

David Uselmann 2 Jan 31, 2022
Simple Java image-scaling library implementing Chris Campbell's incremental scaling algorithm as well as Java2D's "best-practices" image-scaling techniques.

imgscalr - Java Image-Scaling Library http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ Changelog --------- 4.2 * Added sup

Riyad Kalla 1.1k Dec 3, 2022
Java JNA wrapper for Tesseract OCR API

Tess4J A Java JNA wrapper for Tesseract OCR API. Tess4J is released and distributed under the Apache License, v2.0. Features The library provides opti

Quan Nguyen 1.2k Nov 28, 2022
Thumbnailator - a thumbnail generation library for Java

March 11, 2021: Thumbnailator 0.4.14 has been released! See Changes for details. Thumbnailator is now available through Maven! What is Thumbnailator?

Chris Kroells 4.4k Dec 3, 2022
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.4k Dec 3, 2022
Java library for remapper JARs

Pocolifo's JAR Remapper Making remapping JARs easy, organized, and painless Features Remapping Class remapping Method remapping Field remapping Parame

null 8 Oct 2, 2022
A Java Visualization Library based on Apache ECharts.

ECharts Java "We bring better visualization into Java with ECharts" ?? Introduction ECharts Java is a lightweight but comprehensive library for Java d

ECharts Java Open Source Project 154 Nov 28, 2022
Creates ASCII art in Java from Images

Creates ASCII art in Java from Images. It can also save the ASCII art as image (.png) as well

Navjot Singh Rakhra 4 Jul 12, 2022