chuckfairy / node-webcam

Nodejs Cross Platform Webcam usage
MIT License
193 stars 51 forks source link

Added instructions for installing fswebcam on arch/manjaro, fixed small testing issue #62

Closed Oman395 closed 2 years ago

Oman395 commented 2 years ago

Added instructions for building fswebcam on arch. Have not fully tested the package yet on arch, but I've saved a photo correctly first try so I'd say it's safe to assume the bindings will be safe. For whatever reason, fswebcam isn't available for installation on pacman/pamac, however it is available to build, so that's what I've added instructions for.

Oman395 commented 2 years ago

Ran full test, all passed save for webcam list:

Uncaught AssertionError: expected Error: Command failed: fswebcam  -q  -r 1. { .(4) } to be a null

Running the command, it appears to cause a conflict with both bash and zsh:

bash: syntax error near unexpected token `;'
zsh: parse error near `}'

It says 'expected Error', so I'm not sure if it should be like this; I don't have ubuntu installed anywhere, so I'm currently unable to confirm. Additionally, test_image_memory_64.html has a broken image; I'm not sure if the two are related. The file's IMG tag is

<img src="data:image/jpeg;base64,">

Which doesn't appear valid; I could be wrong.

Oman395 commented 2 years ago

As far as I can tell this is a bug caused by a quirk of linux-- as far as I can tell, it will create multiple entries in /dev for cameras (with my laptop's 1 integrated camera, I have /dev/video0 and /dev/video1). When I plug in my external camera, I now have /dev/video0-3, and only video0 and video2 are valid. It looks like we could get the output of

v4l2-ctl --device=/dev/${camera} --all

for any duplicates, specifically looking at the output of the 'serial' section of 'Media Driver Info'-- I'm at least 99% that they will be different for every device, but I could be wrong. However, I don't have 2 of the same device, so for now I'll use the ostrich approach to solving this. The duplicate entries are (AFAIK) always listed after the actual camera, so I should be able to simply make it alternate by 2 instead of 1 if it's using fswebcam-- although I will need to do some more testing.

Oman395 commented 2 years ago

test_image_memory_64.html still broken, IDEK what it's supposed to do lol

chuckfairy commented 2 years ago

Thanks. v4l2-ctl sounds promising for getting a /dev/video list of valid cameras. test_image_memory_64.html was for saving an image to memory testing instead of a file. I could not get a working version of in memory callback so it is broken, but left the test in there.