bytedeco/javacv
View on GitHubpng image stream synthesis webm video transparent channel lost
Open
#2,150 opened on Dec 20, 2023
help wantedquestion
Repository metrics
- Stars
- (6,985 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
I have a png pipeline stream, similar to the one below
PipeInputStream pis = new PipeInputStream()
grabber = new FFmpegFrameGrabber(pis, 0);
grabber.setImageWidth(1920);
grabber.setImageHeight(1080);
grabber.setFrameRate(25);
grabber.setImageMode(FrameGrabber.ImageMode.RAW);
grabber.setFormat("png_pipe");
//Why `PixelFormat` is bgra, because I turn Mat
grabber.setPixelFormat(avutil.AV_PIX_FMT_BGRA);
grabber.start();
FFmpegFrameRecorder
recorder = new FFmpegFrameRecorder("output.webm", 1920, 1080);
recorder.setAudioCodec(avcodec.AV_CODEC_ID_OPUS);
recorder.setVideoCodec(avcodec.AV_CODEC_ID_VP9);
recorder.setFormat("webm");
recorder.start();
Frame frame = null;
while((frame = grabber.grabImage()) != null) {
recorder.record(frame)
}
recorder.close();
grabber.close();
Description:
Images saved as local png files before being written to the pipeline have a transparent channel, but the transparent channel in the generated webm video is lost.webm video generated directly from the FFmpeg command line also has transparent channels
FFmpeg command:
ffmpeg -i %6d.png -c:v libvpx-vp9 -y output.webm