Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default FrameType Causes BGRA Frame Output RGBA #98

Open
MrAdhit opened this issue Jul 5, 2024 · 3 comments
Open

Default FrameType Causes BGRA Frame Output RGBA #98

MrAdhit opened this issue Jul 5, 2024 · 3 comments

Comments

@MrAdhit
Copy link

MrAdhit commented Jul 5, 2024

When I set output_type to default, the frame format is in RGBA even tho it uses the BGRA enum,
this doesn't happen if I specify the output_type to BGRA explicitly

here's the reproducible code
https://gist.github.com/MrAdhit/12a35dec29741703173263717724b5a5

output.mp4
@MrAdhit MrAdhit changed the title Default FrameType Make BGRA Frame Output RGBA Default FrameType Causes BGRA Frame Output RGBA Jul 5, 2024
@RohanPunjani
Copy link
Contributor

Hey, thank you for pointing out the issue!

This behavior occurs because of the ColorFormat being set here

let color_format = match options.output_type {
        FrameType::BGRAFrame => ColorFormat::Bgra8,
        _ => ColorFormat::Rgba8,
};

which sets the color format of any other frameType as Rgba8 which was causing the issue as the default FrameType is set as YUV frame as you can see here

#[derive(Debug, Clone, Copy, Default)]
pub enum FrameType {
    #[default]
    YUVFrame,
    BGR0,
    RGB, // Prefer BGR0 because RGB is slower
    BGRAFrame,
}

@valenotary
Copy link

I think I might be ahving a similar issue with #110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants