Skip to content

FFmpegFrameRecorder close results in EXCEPTION_ACCESS_VIOLATION/SIGSEGV #1616

@voomdoon

Description

@voomdoon

Hi, I am trying to write simple video files (to be used for unit testing of other components reading that files).

example:

import java.awt.image.BufferedImage;

import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.FrameRecorder.Exception;
import org.bytedeco.javacv.Java2DFrameConverter;

public class VideoGenerator {

	private static final int HEIGHT = 48;

	private static final int WIDTH = 64;

	public static void main(String[] args) throws Exception {
		new VideoGenerator().run(args[0]);
	}

	private static BufferedImage getImage(int i) {
		BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
		image.getGraphics().drawString(Integer.toString(i), 10, 10);
		return image;
	}

	private void run(String target) throws Exception {
		FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(target, WIDTH, HEIGHT, 0);

		Java2DFrameConverter converter = new Java2DFrameConverter();

		recorder.start();

		for (int i = 0; i < 1000; i++) {
			recorder.record(converter.convert(getImage(i)));
		}

		System.out.println("flush...");
		recorder.flush();
		System.out.println("close...");
		recorder.close();
		System.out.println("done");
	}
}

the file gets written and is readable, but JVM crashes during close (done is not printed):

  • EXCEPTION_ACCESS_VIOLATION on Windows 10 (avformat-58.dll+0xd9ae7)
  • SIGSEGV on Ubuntu (libavformat.so.58+0x15a64c)

dependencies:

<dependency>
	<groupId>org.bytedeco</groupId>
	<artifactId>javacv</artifactId>
	<version>[1.5.5,1.6)</version>
</dependency>
<dependency>
	<groupId>org.bytedeco</groupId>
	<artifactId>javacv-platform</artifactId>
	<version>[1.5.5,1.6)</version>
</dependency>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions