使用javavc截取视频第一帧放在服务器报错

使用javavc进行视频截取第一帧时,在windows平台能够正常截取。在linux(centos7)上报错,信息如下:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000000000d596, pid=1, tid=0x00007fe629a0cb10
#
# JRE version: OpenJDK Runtime Environment (8.0_212-b04) (build 1.8.0_212-b04)
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 3.12.0
# Distribution: Custom build (Sat May  4 17:33:35 UTC 2019)
# Problematic frame:
# C  0x000000000000d596
#
# Core dump written. Default location: //core or core.1
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid1.log
#

引入依赖:

 <dependency>
    <groupId>org.bytedeco</groupId>
     <artifactId>javacv</artifactId>
     <version>1.4.3</version>
 </dependency>

 <dependency>
     <groupId>org.bytedeco.javacpp-presets</groupId>
     <artifactId>ffmpeg-platform</artifactId>
     <version>4.0.2-1.4.3</version>
 </dependency>

在执行到 ff.start()处报错,错误信息如图上所示。

FFmpegFrameGrabber ff = null;
byte[] data = null;
   ByteArrayOutputStream os = new ByteArrayOutputStream();
   try {
       ff = new FFmpegFrameGrabber(videoPath);
       ff.start();
       

解决方案
导致原因是我在服务器上使用的是openjdk,之前已经更换为了jdk,但还是报错,却忽略了项目是使用docker进行部署的,基础镜像依赖的jdk是openjdk,重新构建基础镜像,运行成功

充满鲜花的世界到底在哪里
原文地址:https://www.cnblogs.com/aliases/p/15686241.html