Skip to content
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

JVM crash happened when running in docker #2245

Closed
354613111 opened this issue Jul 1, 2024 · 1 comment
Closed

JVM crash happened when running in docker #2245

354613111 opened this issue Jul 1, 2024 · 1 comment

Comments

@354613111
Copy link

hs_err_pid1.log

public static int yuvToWebm(String sourcePath, String targetPath, int width, int height) {
int duration = 0;
if (StringUtils.isEmpty(sourcePath) || StringUtils.isEmpty(targetPath)) {
return duration;
}
Frame frame;
try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(sourcePath);
FFmpegFrameRecorder frameRecorder = new FFmpegFrameRecorder(targetPath, 640, 360)) {
//设置yuv420p参数
frameGrabber.setImageWidth(width);
frameGrabber.setImageHeight(height);
frameGrabber.setPixelFormat(8);
//设置webm参数
frameRecorder.setFormat("webm");
//压缩成视频, 2帧压缩成一帧
frameRecorder.setFrameRate(1);
frameRecorder.setVideoCodec(avcodec.AV_CODEC_ID_VP9);
frameRecorder.setVideoOption("preset", "superfast");
frameGrabber.start();
frameRecorder.start();
while ((frame = frameGrabber.grabFrame()) != null) {
try {
frameRecorder.record(frame);
} catch (Exception e) {
log.error("convert h264 to webm failed:", e);
}
}
duration = (int) Math.ceil(frameRecorder.getTimestamp() / 1000000d);
} catch (Exception e) {
log.debug("catch e:", e);
return duration;
}

    return duration;
}
org.bytedeco javacv 1.5.10 org.bytedeco ffmpeg-platform 6.1.1-1.5.10
@saudet
Copy link
Member

saudet commented Jul 1, 2024

Duplicate of #2244

@saudet saudet marked this as a duplicate of #2244 Jul 1, 2024
@saudet saudet closed this as completed Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants