-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FFmpegFrameGrabber casue jvm crash when loading .swf file. #1113
Comments
Does it do that with any other video file? It just looks like that SWF file is corrupted... |
@saudet |
Does it also crash with FFmpeg 4.1 and JavaCV 1.4.4-SNAPSHOT?
|
https://mvnrepository.com/artifact/org.bytedeco/javacv Where can I find FFmpeg 4.1 and JavaCV 1.4.4-SNAPSHOT? Clone the project and build in local? |
I tried with the new snapshot version, the jvm still crash. the fisrt time: the second and the third time: |
It looks like the size of the images change on each frame, must be related to something with that, but it's working just fine with this code here for me: OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat();
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("/tmp/df170e9a-7720-48b7-bf29-4b645c256eba.swf");
grabber.start();
int count = 0;
Frame frame;
while ((frame = grabber.grab()) != null) {
System.out.println(count++);
if (frame.image != null)
imwrite(count + ".jpg", converter.convert(frame));
}
} It's decoding up to 5028 without any apparent issues. |
@saudet |
I test the case, and now I'm sure the swf file cause jvm crash. public void run() {
long currentTimeStamp = 0L;
long lastTimeStamp = 0L;
int frameNumber = 1;
boolean first = true;
Frame frame;
log.info("run: JavaCV start, uuid={}, videoPath={}, screenShotFrequency={}", uuid, videoPath, screenShotFrequency);
try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(videoPath)) {
frameGrabber.setOption("RW_TIMEOUT".toLowerCase(), "3000000");
frameGrabber.setOption("threads", "1");
avutil.av_log_set_level(avutil.AV_LOG_ERROR);
frameGrabber.start();
while ((frame = frameGrabber.grab()) != null) {
currentTimeStamp = frameGrabber.getTimestamp();
int count = 0;
if (frame.image != null) {
log.info("this is a test from roomy, count = {} success = {}", count);
count++;
}
} catch (Exception e) {
log.error("run: exception! uuid={}", uuid, e);
} finally {
}
} Here is the app.err.log info
Here is the app.log:
|
I see, it's currently guessing the file format based on the file extension, but since ffplay doesn't appear to have this issue, maybe there's a safer way to do it now? Anyway, let's leave this issue opened, but marked as enhancement. |
Nope, I just get this error when I try to open it as an "mp4" file:
In any case, I will not be able to fix this until I can reproduce this issue. |
Ah, here's something interesting. It's only happening when using the HTTP protocol. It doesn't happen when reading from a file locally. There's probably some HTTP settings that ffplay sets by default that we'd need to set manually... Comparing the verbose log of both ffplay and FFmpegFrameGrabber might give us a clue about what is different. |
My system is Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux. And I will try other system tonight. It's see if the system casue the problem. |
Actually, with |
Thanks! I will change my version after you fix this bug. Thanks again. |
I will not be able to look into this anytime soon, so if you have some time, please give it a try yourself. Thanks |
Of course, I will test more cases for the problem. |
JavaCV 1.5.6 does not use the deprecated API anymore. Please give it a try and let me know if it fixes this issue or not. Thanks! |
I use FFmpegFrameGrabber to get image frame from videos. Everything was fine until I load some .swf file in my app. And the jvm is crash.
I already try
#1055
#605
but it doesn't work for me.
I use maven to manage my project, and the related javacv config is:
My system is:Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.78-1 x86_64 GNU/Linux
My java code is:
And here is a swf file:
The text was updated successfully, but these errors were encountered: