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

Issues
  • 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
  • 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
  • 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
  • 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
  • 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 47
  • 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
  • ffmpegframerecorder.record() is taking long(sometimes 3-4s per frame)  on android device

    ffmpegframerecorder.record() is taking long(sometimes 3-4s per frame) on android device

    I have modified the RecordActivity on samples and i am able to do a full live stream (to a RTMP server). I see that record(frame) method, continually gets worse. I have tried timestamping the call time and initially it takes < 30 ms to begin with but gradually it hovers around excess of 400ms and stays at that for a while.

    As i let the rtmp stream continue for longer, i end up getting time in excess of >3000 to 4000ms.

    The problem i have is the frame drops i have to manage as Camera is spitting out avg of 30fps. FFmpegframerecorder.record() doesn't keep up with the production rate.

    I am not sure if i am doing anything wrong ? Is it normal for record() to take that much time. I am not applying any filters to the frame. I am also managing the production and consumption rates with a fixed buffer, which is fine.

    But how do i get around the excessive time record() is taking ? What am i missing ? I will try the preset option to ultrafast to see if it helps my case.

    I am using Android R (11) image. Any Ideas or pointers regarding this will be helpful

    opened by streamcam7 6
  • How can javacv open the camera in Android?

    How can javacv open the camera in Android?

    hello, I'm an Android Developer, I'm going to use javacv for live broadcast processing, How can javacv open the camera in Android? In opencv for Android, it is implements camerabridgeviewbase.cvcameraviewlistener2

    enhancement help wanted question 
    opened by liming1010 1
  • getCudaEnabledDeviceCount error

    getCudaEnabledDeviceCount error

    Hello I was trying to check if there is cuda gpu but I get this error

    \modules\core\src\cuda_info.cpp:62: error: (-217:Gpu API call) unknown error in function 'cv::cuda::getCudaEnabledDeviceCount'

    opened by edison245 1
  • 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"
                }
            }
        ]
    }
    
    help wanted question 
    opened by jainvijay 12
  • Blocking Hibernate

    Blocking Hibernate

    1.5.x versions are blocking Hibernate dependencies. there is not ffmpeg.global.avcodec file in 1.4.x. thus can't take audio from video file. 1.4.x not blocking hibernate.

    help wanted question 
    opened by yavuzbalik 3
  • Could not open input (mp4)

    Could not open input (mp4)

    Asking here because I can't seem to find much information after lots of Googling. LMK if this is better asked over at SO.

    I am looking into JavaCV (specifically the FFmpeg module) for transcoding mp4 to HLS within a Scala backend. I am running the exact code found at the following issue from 2017 because it's the best example code I can find for my use case

    The error I'm getting is as follows: avformat_open_input() error -2: Could not open input "/path/to/file.mp4". (Has setFormat() been called?) (For more details, make sure FFmpegLogCallback.set() has been called.)

    I have tried adding both setFormat and FFmpegLogCallback.set with no luck and am not sure what else to do. The sample video I'm using was downloaded directly from TikTok as an mp4.

    I appreciate any support I can get with this issue, Thanks

    help wanted question 
    opened by Enquisidor 7
  • V1.5.6 FFmpegFrameGrabber could not grab frames: avcodec_receive_frame() error -1094995529: Error during video decoding

    V1.5.6 FFmpegFrameGrabber could not grab frames: avcodec_receive_frame() error -1094995529: Error during video decoding

    Ver 1.5.6 (release version)

    Issue: FFmpegFrameGrabber.grab could not grab frames

    Test code:

            try {
                FFmpegLogCallback.set();
    
                FFmpegFrameGrabber g = new FFmpegFrameGrabber("attachment631-small.mp4");
                g.start();
    
                int count_frame = 0;
                while (true) {
                    Frame frame = g.grab();
                    if (frame == null) {
                        break;
                    }
    
                    count_frame++;
                }
    
                g.stop();
                System.out.println("Number of frames: " + count_frame);
            } catch (FFmpegFrameGrabber.Exception e) {
                e.printStackTrace();
            }
    

    Output:

    Warning: [h264 @ 0x7fbac2265800] SEI type 0 overread by 8 bits
    
    Error: [h264 @ 0x7fbac2265800] no frame!
    
    Info: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'attachment631-small.mp4':
    
    Info:   Metadata:
    
    Info:     major_brand     : 
    Info: isom
    Info: 
    
    Info:     minor_version   : 
    Info: 512
    Info: 
    
    Info:     compatible_brands: 
    Info: isomiso2avc1mp41
    Info: 
    
    Info:     encoder         : 
    Info: Lavf57.34.103
    Info: 
    
    Info:   Duration: 
    Info: 00:00:11.00
    Info: , start: 
    Info: 0.000000
    Info: , bitrate: 
    Info: 882 kb/s
    Info: 
    
    Info:   Stream #0:0
    Info: (eng)
    Info: : Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 879 kb/s
    Info: , 
    Info: 60 fps, 
    Info: 60 tbr, 
    Info: 19200 tbn, 
    Info: 59.94 tbc
    Info:  (default)
    Info: 
    
    Info:     Metadata:
    
    Info:       handler_name    : 
    Info: VideoHandler
    Info: 
    
    Info:       vendor_id       : 
    Info: [0][0][0][0]
    Info: 
    
    Warning: [h264 @ 0x7fbac1a79600] SEI type 0 overread by 8 bits
    
    Error: [h264 @ 0x7fbac1a79600] no frame!
    
    Error: [h264 @ 0x7fbac1a75200] no frame!
    
    Error: [h264 @ 0x7fbac1a75e00] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b18000] no frame!
    
    Error: [h264 @ 0x7fbac1b18c00] no frame!
    
    Error: [h264 @ 0x7fbac1b19800] no frame!
    
    Error: [h264 @ 0x7fbac1a79c00] no frame!
    
    Error: [h264 @ 0x7fbac1a75800] no frame!
    
    Error: [h264 @ 0x7fbac1b15c00] no frame!
    
    Error: [h264 @ 0x7fbac1b16800] no frame!
    
    Error: [h264 @ 0x7fbac1b17400] no frame!
    
    Error: [h264 @ 0x7fbac1b17a00] no frame!
    
    Error: [h264 @ 0x7fbac1b18600] no frame!
    
    Error: [h264 @ 0x7fbac1b19200] no frame!
    
    Error: [h264 @ 0x7fbac1a79600] no frame!
    
    Error: [h264 @ 0x7fbac1a75200] no frame!
    
    Error: [h264 @ 0x7fbac1a75e00] no frame!
    
    Error: [h264 @ 0x7fbac1b16200] no frame!
    
    Error: [h264 @ 0x7fbac1b16e00] no frame!
    
    Error: [h264 @ 0x7fbac1b17a00] no frame!
    
    Error: [h264 @ 0x7fbac1b18600] no frame!
    
    Error: [h264 @ 0x7fbac1b19200] no frame!
    
    Error: [h264 @ 0x7fbac1a79600] no frame!
    
    Error: [h264 @ 0x7fbac1a75200] no frame!
    
    Error: [h264 @ 0x7fbac1a75e00] no frame!
    
    Error: [h264 @ 0x7fbac1b16200] no frame!
    
    Error: [h264 @ 0x7fbac1b16e00] no frame!
    
    Error: [h264 @ 0x7fbac1b17a00] no frame!
    
    Error: [h264 @ 0x7fbac1b18600] no frame!
    
    Error: [h264 @ 0x7fbac1b19200] no frame!
    
    Error: [h264 @ 0x7fbac1a79600] no frame!
    
    Error: [h264 @ 0x7fbac1a75200] no frame!
    
    Error: [h264 @ 0x7fbac1a75e00] no frame!
    
    Error: [h264 @ 0x7fbac1b16200] no frame!
    
    Error: [h264 @ 0x7fbac1b16e00] no frame!
    
    Error: [h264 @ 0x7fbac1b17a00] no frame!
    
    Error: [h264 @ 0x7fbac1b18600] no frame!
    
    Error: [h264 @ 0x7fbac1b19200] no frame!
    
    Error: [h264 @ 0x7fbac1a79600] no frame!
    
    Error: [h264 @ 0x7fbac1a75200] no frame!
    
    org.bytedeco.javacv.FFmpegFrameGrabber$Exception: avcodec_receive_frame() error -1094995529: Error during video decoding. (For more details, make sure FFmpegLogCallback.set() has been called.)
    	at org.bytedeco.javacv.FFmpegFrameGrabber.grabFrame(FFmpegFrameGrabber.java:1388)
    	at org.bytedeco.javacv.FFmpegFrameGrabber.grab(FFmpegFrameGrabber.java:1280)
    	at abc.Test.main(Test.java:23)
    

    OS: Mac and Centos

    Test video: attachment631-small.mp4.zip

    bug 
    opened by luunn54 8
  • V1.5.6 FFmpegFrameGrabber could not grab frames: avcodec_send_packet() error -1094995529

    V1.5.6 FFmpegFrameGrabber could not grab frames: avcodec_send_packet() error -1094995529

    Thanks you for your working hard to release v1.5.6. I tested and found an issue:

    Ver 1.5.6 (release version)

    Issue: FFmpegFrameGrabber.grab could not grab frames Test code:

            try {
                FFmpegLogCallback.set();
    
                FFmpegFrameGrabber g = new FFmpegFrameGrabber("t.mpg");
                g.start();
    
                int count_frame = 0;
                while (true) {
                    Frame frame = g.grab();
                    if (frame == null) {
                        break;
                    }
    
                    count_frame++;
                }
    
                g.stop();
                System.out.println("Number of frames: " + count_frame);
            } catch (FFmpegFrameGrabber.Exception e) {
                e.printStackTrace();
            }
    

    Output:

    Error: [mp3float @ 0x7fe47316aa00] Header missing
    
    Warning: [mpegts @ 0x7fe471a4d400] DTS 9000 < 12600 out of order
    
    Info: Input #0, mpegts, from 't.mpg':
    
    Info:   Duration: 
    Info: 00:00:14.05
    Info: , start: 
    Info: 0.086122
    Info: , bitrate: 
    Info: 768 kb/s
    Info: 
    
    Info:   Program 1 
    
    Info:   Stream #0:0
    Info: [0x12d]
    Info: : Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bottom first), 352x288 [SAR 12:11 DAR 4:3]
    Info: , 
    Info: 25 fps, 
    Info: 25 tbr, 
    Info: 90k tbn, 
    Info: 50 tbc
    Info: 
    
    Info:     Side data:
    
    Info:       
    Info: cpb: 
    Info: bitrate max/min/avg: 500000/0/0 buffer size: 147456 
    Info: vbv_delay: N/A
    Info: 
    
    Info:   Stream #0:1
    Info: [0x12e]
    Info: : Audio: mp3 ([3][0][0][0] / 0x0003), 44100 Hz, mono, fltp, 128 kb/s
    Info: 
    
    Error: [mp3float @ 0x7fe470204200] Header missing
    
    org.bytedeco.javacv.FFmpegFrameGrabber$Exception: avcodec_send_packet() error -1094995529: Error sending an audio packet for decoding. (For more details, make sure FFmpegLogCallback.set() has been called.)
    	at org.bytedeco.javacv.FFmpegFrameGrabber.grabFrame(FFmpegFrameGrabber.java:1414)
    	at org.bytedeco.javacv.FFmpegFrameGrabber.grab(FFmpegFrameGrabber.java:1280)
    	at abc.Test.main(Test.java:23)
    Disconnected from the target VM, address: '127.0.0.1:60978', transport: 'socket'
    
    Process finished with exit code 0
    

    OS: Mac and Centos

    Test video: t.mpg.zip

    bug 
    opened by luunn54 6
  • Video quality inspection

    Video quality inspection

    Hello, I would like to ask if javacv has an interface to detect video clip frame, snow field or color bar detection

    help wanted question 
    opened by Nirvana-feng 1
  • `setVideoQuality(…)` and libx264 crash based on locale

    `setVideoQuality(…)` and libx264 crash based on locale

    In my application I use the FFmpegFrameRecorder with the following configuration:

    recorder.setFormat("matroska"); // mp4 doesn't support streaming
    recorder.setAudioCodec(AV_CODEC_ID_NONE);
    recorder.setVideoCodec(AV_CODEC_ID_H264);
    recorder.setPixelFormat(AV_PIX_FMT_YUV420P);
    recorder.setFormat("mp4");
    recorder.setVideoQuality(24);
    recorder.setFrameRate(fps);
    

    Setting the video quality (recorder.setVideoQuality(24);) works or crashes based on the locale of the user. The error message states the reason very clearly:

    [libx264 @ 0x7fad69fb2e00] [Eval @ 0x306975170] Invalid chars '.0' at the end of expression '24.0'
    [libx264 @ 0x7fad69fb2e00] Unable to parse option value "24.0"
    [libx264 @ 0x7fad69fb2e00] Error setting option crf to value 24.0.
    

    I JavaCV, the parameter of setVideoQuality is of type double. libx264 parses the double value which works with an English locale, because an English locate uses the period . character as a decimal separator. In other locales, like mine, the comma , character is used as a decimal separator and the period separates the thousands (like 1.234,56).

    I'm using JavaCV 1.5.5 with Java 16.0.1 on macOS 11.4.

    Steps to reproduce using the GPX Animator project:

    git clone https://github.com/zdila/gpx-animator.git
    cd gpx-animator
    LANG="en_US.UTF-8" ./gradlew clean it
    LANG="de_CH.UTF-8" ./gradlew clean it
    

    Using the steps to reproduce above, the first run uses the English locale and is successful. The second run uses the Swiss-German locale and fails. The it target is my integration test. Don't omit the clean, because Gradle caches the results and we don't change the source during the runs.

    If you need more information, please ask and I'm happy to provide any helpful answers.

    bug help wanted 
    opened by McPringle 2
Releases(1.5.6)
  • 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
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 767 Sep 12, 2021
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 Aug 24, 2021
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 3.8k Sep 17, 2021
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.3k Sep 17, 2021
Diagrams as code is a term used for storing the source of a diagram image as a text file.

Diagrams as code Diagrams as code is a term used for storing the source of a diagram image as a text file. Examples are architecture diagrams, or diag

null 18 Sep 10, 2021
Traditional roguelike game with pixel-art graphics and simple interface

Traditional roguelike game with pixel-art graphics and simple interface

Evan Debenham 1.4k Sep 10, 2021
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 12 Sep 1, 2021
Roman Beskrovnyi 167 Sep 8, 2021
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 May 13, 2021
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 28.4k Sep 13, 2021
图片/GIF/音频/点选验证码生成工具,可以自定义图片尺寸,字体,颜色,干扰项等等。

简介 captcha是一个图片/点选/音频验证码生成工具库。 1.调用ImageCaptchaUtil中的方法来生成验证码图片信息,支持返回图片byte[],base64字符串和base64Data字符串。可设置干扰线类型来生成不同干扰类型的验证码图片。可已自定义图片背景颜色,图片宽度高度,字体,字

牛长清 22 Sep 2, 2021
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 1k Sep 16, 2021
Open source Picture to text, text to Picture app

Pic SMS App Pic SMS is a free open source app. With Pic SMS, you can: convert pictures into text parts and send as SMS convert text parts into a pictu

Kaung Khant Kyaw 15 Sep 14, 2021
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 3 Sep 15, 2021
Custom Image Server for use with ShareX

rImageServer How to use: Normal Instalation: Download .jar Start: javar -jar [filename].jar Edit: imageserver.propierties Check if web works -> Go to

Ryzeon 13 Aug 27, 2021
VisionCamera Frame Processor Plugin to label images using MLKit Vision

vision-camera-image-labeler A VisionCamera Frame Processor Plugin to label images using MLKit Vision Image Labeling. Installation npm install vision-c

Marc Rousavy 46 Sep 14, 2021