l1npengtul / nokhwa

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

arm support #92

Open makerio90 opened 1 year ago

makerio90 commented 1 year ago

is there any info on arm support? (armv7 and aarch64)? id like to use this on a raspberry pi but I've had issues with cross compiling webcam lib's before.

if not, is there any plan to support arm architectures in the future?

l1npengtul commented 1 year ago

There isnt anything inherent in the code that would prevent it from working on ARM. You will have to set up a C cross compiler though.

leofidus commented 1 year ago

For what it's worth, 0.10.3 compiles and runs the examples on my aarch64 if I modify it to set default-features = false for the mozjpeg dependency in nokhwa-core (the purpose of that change is to disable he simd support of mozjpeg since that didn't compile for me)

makerio90 commented 1 year ago

nah, aarch64 does not work with v4l, but thats an issue with v4l-rs not nokhawa

leofidus commented 1 year ago

I was testing on Windows, so I can't comment on v4l. But still, you might have luck with the opencv backend?

l1npengtul commented 1 year ago

I'll add this to the 0.11 roadmap... Time to find a RPi... 😔

makerio90 commented 1 year ago

I was testing on Windows, so I can't comment on v4l. But still, you might have luck with the opencv backend

ill try that for now

I'll add this to the 0.11 roadmap... Time to find a RPi... :pensive:

no need, you can use a docker container with the --platform flag

l1npengtul commented 1 year ago

Will add that to the docs... Ty!

makerio90 commented 1 year ago

...as in you can use docker to simulate a aarch64 machine and avoid having to buy a rpi, using a docker container is far from the best solution.

benpoulson commented 1 year ago

Even easier, using cross-rs you can just run via docker without needing to set anything up yourself.

cross build --target "aarch64-unknown-linux-gnu" --release

But yeah,

   [...]
   Compiling tungstenite v0.18.0
   Compiling v4l2-sys-mit v0.2.0
error: failed to run custom build command for `v4l2-sys-mit v0.2.0`

Caused by:
  process didn't exit successfully: `/target/release/build/v4l2-sys-mit-b44260cfc87d58f0/build-script-build` (exit status: 101)
  --- stderr
  /usr/include/linux/videodev2.h:60:10: fatal error: 'sys/time.h' file not found
  /usr/include/linux/videodev2.h:60:10: fatal error: 'sys/time.h' file not found, err: true
  thread 'main' panicked at 'Failed to generate bindings: ()', /home/benpoulson/.cargo/registry/src/github.com-1ecc6299db9ec823/v4l2-sys-mit-0.2.0/build.rs:10:10
  note: run with `RUST_BACKTRACE=1` environment variable to disp
UnknownError55 commented 1 year ago

@makerio90 I am currently running this library on an actual RaspberryPi 4 model B. The specifics of the OS is: Linux raspberrypi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux The only issue I have with it is getting the RaspberryPi HD Camera to work with the library. However, I have tested a Logitech webcam plugged into the RaspberryPi, and the library is able to pull out frames just fine.

makerio90 commented 1 year ago

OH! maybe it just has issues with cross compiles.