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

Set YUYV as the default frame format. #21

Closed
wants to merge 1 commit into from

Conversation

ayakoakasaka
Copy link
Collaborator

@ayakoakasaka ayakoakasaka commented Dec 11, 2023

This implementation assumes that the default environment is set to YUYV, but that's not the case in my setup. Therefore, I want to set YUYV explicitly as the default. Interestingly, even though this setting returns an error, it applies successfully in behavior.

@ayakoakasaka ayakoakasaka requested a review from yamt December 11, 2023 09:15
@yamt
Copy link
Collaborator

yamt commented Dec 11, 2023

This implementation assumes that the default environment is set to YUYV, but that's not the case in my setup. Therefore, I want to set YUYV explicitly as the default. Interestingly, even though this setting returns an error, it applies successfully in behavior.

where is the YUYV assumption?

// Attempted to set the YUYV format but encountered an error.
// Note: This error might be a false positive, and the format setting could actually be applied.
// This behavior may be specific to certain camera models/drivers,
// so it's important to carefully check the situation and implement additional verification if necessary.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please investigate a bit and at least report a bug before adding a workaround?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

@ayakoakasaka
Copy link
Collaborator Author

let (pixel_format, byte_per_pixel) = match buffer.source_frame_format() {
FrameFormat::YUYV => (wasi::buffer_pool::data_types::PixelFormat::Yuy2, 2),
_ => {
println!("NokhwaDevice dropping a frame with unimplemented format");
return;
}
};

is accepting YUYV only so far

@yamt
Copy link
Collaborator

yamt commented Dec 11, 2023

let (pixel_format, byte_per_pixel) = match buffer.source_frame_format() {
FrameFormat::YUYV => (wasi::buffer_pool::data_types::PixelFormat::Yuy2, 2),
_ => {
println!("NokhwaDevice dropping a frame with unimplemented format");
return;
}
};

is accepting YUYV only so far

the intention here is to pass frames as they are.
not convert everything to YUYV.
what pixel format are you seeing here?

@ayakoakasaka
Copy link
Collaborator Author

In my case, it seems MJPG

ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
    [1]: 'YUYV' (YUYV 4:2:2)

@yamt
Copy link
Collaborator

yamt commented Dec 11, 2023

In my case, it seems MJPG

ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
    [1]: 'YUYV' (YUYV 4:2:2)

i've heard that mjpeg is somehow commonly used for usb cameras.
i guess it makes sense to support it natively.

@ayakoakasaka
Copy link
Collaborator Author

ok. I understand your opinion

@yamt
Copy link
Collaborator

yamt commented Dec 12, 2023

@ayakoakasaka can you try #22?

@ayakoakasaka
Copy link
Collaborator Author

Yes. #22 solved my problem.
Thank you. I will close this PR

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

Successfully merging this pull request may close these issues.

2 participants