question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SequenceEncoder to allow specify important h.264 encoding parameters

See original GitHub issue

Hi,

I am using JCodec to encode a sequence of images to a mp4. I want to use encode using H.264 but I am encountering a problem with the colors. It looks fine with Prores but I want the video to be playable in Windows Media Player.

H.264: https://www.youtube.com/watch?v=8yjfzw9saH4

Prores: https://www.youtube.com/watch?v=3JL-zIfbNbE

SequenceEncoder mEncoder = new SequenceEncoder(NIOUtils.writableChannel(file),
        Rational.R(30, 1), Format.MOV, Codec.H264, null);

for (int i = 0; i < 300; i++) {
    BufferedImage img = new BufferedImage(1080, 1920, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();

    GradientPaint p = new GradientPaint(540, 0, Color.GREEN, 540, 1500, Color.BLUE);

    g.setPaint(p);
    g.fillRect(0, 0, 1080, 1920);

    g.setColor(Color.RED);
    g.fillOval(i * 3, i * 6, 200, 200);

    mEncoder.encodeNativeFrame(AWTUtil.fromBufferedImageRGB(img));
}

mEncoder.finish();

Is there some setting that can prevent this behaviour?

I also tried encoding a mkv using VP8 but the duration and frame rate is off.

Thanks in advance,

Isadora

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
beruiccommented, Aug 21, 2019

I have this same issue. Can you give an example on how I create my encoder with lower QP?

0reactions
svitvitskiycommented, Jan 2, 2018

I am sorry, yes, I meant decreasing the QP. Thanks for confirming.

Read more comments on GitHub >

github_iconTop Results From Across the Web

H.264 Video Encoding Guide - FFmpeg Wiki
This method allows the encoder to attempt to achieve a certain output quality for the whole file when output file size is of...
Read more >
H.264 Base/Main/High Profile Encoder on DM365/DM368
of the H264 encoded video. ❑ Appendix F – Revision History, highlights the changes made to the. SPRUEU9A codec specific user guide to...
Read more >
H.264 Video Encoder - Win32 apps - Microsoft Learn
The H.264 encoder implements the ICodecAPI interface for setting encoding parameters. It supports the following properties.
Read more >
java - Encode a video into h264 using bufferedimages?
Here's how you can do it with JCodec: public class SequenceEncoder { private SeekableByteChannel ch; private Picture toEncode; ...
Read more >
Video Encoding Settings for H.264 Excellence - Lighterra
The lower resolutions all use identical audio settings to allow switching cleanly ... the next most important setting is the overall encoding strategy....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found