I want to grab a frame from a locally stored video to use as a thumbnail and need to rotate it based on the video rotation metadata. If i skip the rotation and directly convert to buffered image, it works fine using Java2DFrameConverter.convert(), but if i put it through the filter to rotate, then java crashes at the convert() call.
Note this code is kotlin
// grab frame from video
val grabber = FFmpegFrameGrabber(videoUrl)
grabber.start()
var image = grabber.grabImage()
// rotate the image if the video has rotation
val videoRotation = grabber.displayRotation
if (videoRotation != 0.0) {
val filter =
FFmpegFrameFilter("rotate=${videoRotation / 180 * Math.PI}", grabber.imageWidth, grabber.imageHeight)
filter.start()
filter.push(image)
image = filter.pull()
filter.stop()
filter.close()
}
val buff_img = Java2DFrameConverter().convert(image)
The main part of the error is:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000018e243e92e7, pid=1117280, tid=1117632
#
# JRE version: OpenJDK Runtime Environment (21.0.1+12) (build 21.0.1+12-29)
# Java VM: OpenJDK 64-Bit Server VM (21.0.1+12-29, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# J 1774 c2 jdk.internal.misc.ScopedMemoryAccess.getByte(Ljdk/internal/foreign/MemorySessionImpl;Ljava/lang/Object;J)B java.base@21.0.1 (16 bytes) @ 0x0000018e243e92e7 [0x0000018e243e92a0+0x0000000000000047]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# ...\hs_err_pid1117280.log
[2.619s][warning][os] Loading hsdis library failed
is there some step i need to do after pulling from the filter? i tried pullImage() as well but same issue
I want to grab a frame from a locally stored video to use as a thumbnail and need to rotate it based on the video rotation metadata. If i skip the rotation and directly convert to buffered image, it works fine using Java2DFrameConverter.convert(), but if i put it through the filter to rotate, then java crashes at the convert() call.
Note this code is kotlin
The main part of the error is:
is there some step i need to do after pulling from the filter? i tried pullImage() as well but same issue