1

I've created a video by JCodec applying the following code. But it is blinking. I tried to change fps from 24 to 30 and 60 but still, it has the blinking side effect. I verified with different source graphic formats png and jpg. Especially the side effect is seen when the background of the source images is dark.

Code of JCodec:

List<String> images = new ArrayList<>();
File mp4file = new File(String.format("upload-dir/%d/%s", id, id + ".mp4"));
...
try {
    AWTSequenceEncoder sequenceEncoder = new AWTSequenceEncoder(NIOUtils.writableChannel(mp4file),
            Rational.R(60, 1));

    int imageDelay = 4 * 60;

    for (String image: images) {
        BufferedImage img = ImageIO.read(new File(image));

        for (int i = 0; i < imageDelay; i++)
            sequenceEncoder.encodeImage(img);
    }
    sequenceEncoder.finish();
} catch (IOException e) {
    e.printStackTrace();
}
baitmbarek
  • 2,440
  • 4
  • 18
  • 26
0x01
  • 29
  • 1

0 Answers0