在JavaCV中使用FFmpegFrameRecorder时,JVM崩溃并显示以下消息:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000699d6a64, pid=4076, tid=308
#
# JRE version: 7.0_13-b20
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [avformat-54.dll+0xd6a64] av_read_play+0x4
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Sagar Jadhav\Documents\NetBeansWorkspace\OpenCV\hs_err_pid4076.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 1
代码如下:
package com.opencv.windows;
import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FFmpegFrameGrabber;
import com.googlecode.javacv.FFmpegFrameRecorder;
import com.googlecode.javacv.OpenCVFrameGrabber;
import com.googlecode.javacv.cpp.opencv_core;
public class VideoRecorderDemo
{
OpenCVFrameGrabber grabber;
FFmpegFrameRecorder recorder;
CanvasFrame canvasFrame;
VideoRecorderDemo()
{
grabber = new OpenCVFrameGrabber("c:\\sample.mp4");
recorder = new FFmpegFrameRecorder("c:\\sample1.mp4", 2);
canvasFrame = new CanvasFrame("Video Recorder Demo");
canvasFrame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
try
{
grabber.start();
opencv_core.IplImage image;
while((canvasFrame.isVisible()) && (image = grabber.grab()) != null)
canvasFrame.showImage(image);
}
catch(Exception e)
{
System.out.println("Error : " + e.getMessage());
}
init();
startRecording();
stopRecording();
}
void init()
{
try
{
grabber.start();
recorder.start();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
void startRecording()
{
try
{
opencv_core.IplImage image;
while((canvasFrame.isVisible()) && (image = grabber.grab()) != null)
{
recorder.record(image);
canvasFrame.showImage(image);
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
void stopRecording()
{
try
{
grabber.stop();
recorder.stop();
canvasFrame.dispose();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
public static void main(String args[])
{
new VideoRecorderDemo();
}
}
我正在使用OpenCV 2.4.3库和zeronoe提供的ffmpeg库(ffmpeg-20130209-git-969039e-win64-shared)
谢谢
答案 0 :(得分:0)
你必须使用这个版本的ffmpeg:
http://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-20121029-git-11d695d-win64-shared.7z
我有你的问题,但我搜索了JavaCV自述文件,我发现JavaCV已经用这个版本的ffmpeg编译
祝你好运