bytedeco/javacv

Automatic conversion to supported format in FFmpegFrameRecorder?

Open

#1,183 opened on Apr 10, 2019

View on GitHub
 (16 comments) (1 reaction) (0 assignees)Java (1,583 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I have video frames in a specific format, which is not always supported by an encoder. Is there a way to instruct FFmpegFrameRecorder to convert the data from my (known) format to one of the desired formats before encoding? Or maybe a sub-automatic way? I tried going through supported formats for an encoder, like so:

avcodec.AVCodec enc = avcodec_find_encoder_by_name(encoder);
IntPointer formats = enc.pix_fmts();
// going through formats using get() and storing a format inside selectedFormat

and setting one of those in recorder, like so:

recorder.setPixelFormat(selectedFormat);

and recording frame like so:

recorder.record(frame, PIXEL_FORMAT); // pixel format is the format of frame 

It doesn't work, obviously. Am I doing it wrong?

Contributor guide