l1npengtul / nokhwa

Cross Platform Rust Library for Powerful Webcam/Camera Capture
Apache License 2.0
502 stars 121 forks source link

Cannot set frame format in avfoundation #94

Closed bookshiyi closed 9 months ago

bookshiyi commented 1 year ago

As mentioned before : https://github.com/l1npengtul/nokhwa/issues/72#issuecomment-1380531832

Even if I use function camera.set_frame_format(FrameFormat::YUYV) try to set frame format to YUYV, but frame's format is still NV12 by function camera.frame().unwrap().source_frame_format()

After some checks:


Thanks to all contributors.

bookshiyi commented 1 year ago

btw, may an another bug in these code? https://github.com/l1npengtul/nokhwa/blob/dd0cd6e62850ba3a08de8d4fbd682b7033156459/nokhwa-bindings-macos/src/lib.rs#L1014-L1026

only min_frame_duration but max_frame_duration can not be found

bookshiyi commented 1 year ago

I found a temporary solution that may help people with similar problems:

Use camera.set_camera_requset(request) after camera.open_stream() to set frame_format to YUYV, it can work.

btw, If you want set frame format to YUYV by function set_frame_format() in anywhere, or set_camera_request() before open_stream(), maybe not take effect.

Although I don't know where the problem is.

yamt commented 10 months ago

related: https://github.com/l1npengtul/nokhwa/pull/151