Javacpp-presets: Fatal error SIGSEGV on avio_open (ffmpeg)

Created on 12 Apr 2018  路  1Comment  路  Source: bytedeco/javacpp-presets

I'm having some problems using this with ffmpeg. The java run-time crashes when avio_open is called. Is this a bug with the library or am I using it incorrectly? Code adapted from the remuxing.c example for ffmpeg.

Source (crash happens on line 48): https://gist.github.com/laurenkt/0342c1c30fd5137b47c841428df263ff

The app seems to create the output file when this method is invoked, but then crashes.

Java command line output:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './local_file.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2013-12-27T17:36:30.000000Z
  Duration: 00:12:21.92, start: 0.000000, bitrate: 369 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 270 kb/s, 25 fps, 25 tbr, 50 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2013-12-27T17:36:32.000000Z
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
Output #0, mp4, to './new_file.mp4':
    Stream #0:0: Unknown: none
    Stream #0:1: Unknown: none
:src:TestModules.main()
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000012caa2408, pid=26318, tid=0x0000000000000307
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libavformat.57.dylib+0x22408]  avio_rb64+0x238
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/lauren/IdeaProjects/unlockyork/hs_err_pid26318.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
:src:TestModules.main() FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':src:TestModules.main()'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java'' finished with non-zero exit value 134

System reports java terminated unexpectedly with this crash report: https://gist.github.com/laurenkt/20cc5eda70efa24a6086345199789e03

question

Most helpful comment

That call is a bit tricky because we need to actually set the value in AVFormatContext as shown here:
https://github.com/bytedeco/javacv/blob/master/src/main/java/org/bytedeco/javacv/FFmpegFrameRecorder.java#L812
In your case, we could do something like this:

AVIOContext pb = new AVIOContext(null);
ret = avio_open(pb, out_filename, AVIO_FLAG_WRITE);
outputFormatCtx.pb(pb);

>All comments

That call is a bit tricky because we need to actually set the value in AVFormatContext as shown here:
https://github.com/bytedeco/javacv/blob/master/src/main/java/org/bytedeco/javacv/FFmpegFrameRecorder.java#L812
In your case, we could do something like this:

AVIOContext pb = new AVIOContext(null);
ret = avio_open(pb, out_filename, AVIO_FLAG_WRITE);
outputFormatCtx.pb(pb);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

oneengineer picture oneengineer  路  34Comments

Neiko2002 picture Neiko2002  路  32Comments

siddharthmudgal picture siddharthmudgal  路  26Comments

kwatters picture kwatters  路  24Comments

blueberry picture blueberry  路  32Comments