Skip to content

VideoCapture with CAP_ANDROID generates RGB frames instead of BGR #24687

@alexlyulkov

Description

@alexlyulkov

System Information

Android 9

Detailed description

When loading H264 video on Android using VideoCapture with CAP_ANDROID api, it returns RGB frames instead of BGR.
If you copy a H264 video using VideoCapture + VideoWriter, it switches red and blue colors.

Steps to reproduce

videoCapture = new VideoCapture(videoFilename1, Videoio.CAP_ANDROID);
Mat frame = new Mat();
videoCapture.read(frame);

videoWriter = new VideoWriter();
videoWriter.open(videoFilename2, Videoio.CAP_ANDROID, VideoWriter.fourcc('H', '2', '6', '4'), FPS, new Size(frame.cols(), frame.rows()));

videoWriter.write(frame);
while (true) {
    videoCapture.read(frame);
    if (frame.empty()) {
        break;
    }
    videoWriter.write(frame);
}
videoWriter.release();
videoCapture.release();

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions