GloDroid / glodroid_manifest

Android port that aims to bring both user- and developer-friendly experience in using AOSP with a set of single-board computers (SBC), phones and other devices.
472 stars 66 forks source link

usb camera does not work RPI4 #168

Open kiai72 opened 3 years ago

kiai72 commented 3 years ago

usb camera (rpi4) isn't working. Is this a known issue ?

rsglobal commented 3 years ago

Thanks for reporting, i'll check it. Could you update issue description accordingly?

ghost commented 3 years ago

For me it works, just do not use the open camera app already installed. That's OK for the CSI camera, but for the USB camera install some other apk it's possible to find for free on web

kiai72 commented 3 years ago

can you please check if it works for you in a browser (chrome dev or firefox) ? https://webcamtests.com/

one more question: did you try 0.5.1 or 0.6.1 ? (me: 0.6.1)

ghost commented 3 years ago

I've just tried v0.6.1 and in the browser does not work

kiai72 commented 3 years ago

ok, my main-usage for android is: i want to do jitsi, zoom and skype. jitsi works fine in raspberryOS - in the browser. But zoom hardly works - and skype not at all. Not even in the browser -> that's why i wanted to have the camera running in browser. But if it works in zoom app and skype app - that would be fine as well. (do you know ?)

ghost commented 3 years ago

No idea if Zoom and Skype are available, I do not see them in Aurora Store but I feel they are quite heavy as apps...

kiai72 commented 3 years ago

i tried skype lite (install apk). I can use skype - but my camera picture is not captured and shown to the other participants.

ghost commented 2 years ago

Quick update about this issue using the new version based on Android 12. Skype is now available as apk but USB camera is not detected by it. On the opposite CSI Rpi Camera yes, but the image gets completely messed up.

kiai72 commented 2 years ago

thank you for keeping me updated. I hope USB-cameras will be supported in future.

KonstaT commented 2 years ago

I got myself a HDMI-USB video capture device as I didn't need another USB webcam (one I have doesn't support MJPG). Someone recommended it because it uses MJPG and it's still basically an UVC webcam so it can be used with the external camera HAL.

I had two errors with minigbm gralloc.

One with starting the camera preview:

E [minigbm:CrosGralloc4Allocator.cc(52)]: Unsupported combination -- pixel format: YV12, drm format:DRM_FOURCC_9997, usage: CPU_READ_NEVER | CPU_WRITE_NEVER | CPU_WRITE_RARELY | CPU_WRITE_OFTEN | GPU_TEXTURE | CAMERA_OUTPUT (0x20130)

And another one when capturing an image:

E [minigbm:CrosGralloc4Allocator.cc(52)]: Unsupported combination -- pixel format: BLOB, drm format:DRM_FOURCC_R8  , usage: CPU_READ_NEVER | CPU_READ_RARELY | CPU_READ_OFTEN | CPU_WRITE_NEVER | CPU_WRITE_RARELY | CPU_WRITE_OFTEN | CAMERA_OUTPUT (0x20033)

Added this: https://github.com/lineage-rpi/android_external_minigbm/commit/f9d7925d81c7b40efb56586188f34952f29dc7e9 Preview, photos, and recording videos work fine after that and doesn't seem it broke anything with Pi camera modules or hw video dec. Only "issue" is that camera preview is vertically mirrored (selfie mirror effect?) but only on the camcorder preview. :o

@rsglobal Does that look sane to you?

rsglobal commented 2 years ago

@KonstaT

Does that look sane to you?

More than. Thank you. Will add this to the my minigbm fork as well.

kiai72 commented 2 years ago

nice! will this be implemented in GloDroid and/or konstagang's rom soon ?

rsglobal commented 2 years ago

Unfortunately both of my cameras don't expose V4L2_CAP_VIDEO_CAPTURE , therefore can't be used with external camera HAL (at least without modification of the HAL). https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp;l=247;drc=34cdbcde5096aa8d822626d953f9a493a6fa835f

KonstaT commented 2 years ago

nice! will this be implemented in GloDroid and/or konstagang's rom soon ?

It's already in my latest LineageOS 19 build and I see Roman added a similar thing on GloDroid. But as you can see from the comments it's likely that there's more UVC webcams that won't work for various reasons than ones that do.

Unfortunately both of my cameras don't expose V4L2_CAP_VIDEO_CAPTURE

I guess getting that HDMI-USB video capture card was a good suggestion that was made to me.

kiai72 commented 2 years ago

I guess getting that HDMI-USB video capture card was a good suggestion that was made to me.

? can you please explain: what is that card ? you connect it via HDMI to the PI - or via USB ?

KonstaT commented 2 years ago

? can you please explain: what is that card ? you connect it via HDMI to the PI - or via USB ?

If you were really cheeky, why not both. :P

It has an USB in one end and HDMI in another end. It's used to make screen recordings i.e. capture HDMI signal from some device and it exposes it as an USB camera to another device to record (Pi with the camera app in this case). Or you could also use it capture the screen of your Pi as e.g. many YouTubers do (but that's not the case here).

kiai72 commented 2 years ago

? can you please explain: what is that card ? you connect it via HDMI to the PI - or via USB ?

If you were really cheeky, why not both. :P

It has an USB in one end and HDMI in another end. It's used to make screen recordings i.e. capture HDMI signal from some device and it exposes it as an USB camera to another device to record (Pi with the camera app in this case). Or you could also use it capture the screen of your Pi as e.g. many YouTubers do (but that's not the case here).

got it. Thank you. By the way: in the meanwhile i checked your konstakang-release of today. Camera app says "cannot connect to camera". It's a USB UVC cam with MJPG. i posted this - WITH LOGCAT - at konstakang.com a few minutes ago.

ghost commented 2 years ago

And any idea why with Skype the image from the CSI Rpi Camera is completely messed up? It works very well with the included Camera app

kiai72 commented 2 years ago

Besides "Skype" there is also "Skype Lite"! Maybe you want to try if this works. https://www.apkmirror.com/apk/skype/skype-lite/

ghost commented 2 years ago

With Skype Lite same behavior + Android Reboot :)

kiai72 commented 2 years ago

there's also a browser based skype version (skype web). It works with webrtc. Microsoft tries to block all browsers beside chrome and edge. I had it running on fydeOS/chromeOS on the raspberry before, so there blocker is not 100%. Maybe it's worth trying. Maybe with "chrome dev", as far as i know even firefox is blocked.

ghost commented 2 years ago

I was able to use Skype Web on Firefox, CSI Rpi Camera works fine only on Preview. I do not know why it is not available during normal calls. Anyway it can be a limitation on Firefox or HW porting, I am using an Rpi4 and you?

kiai72 commented 2 years ago

i remember that i had similar effects: see my camera picture - but it will not be transfered to the other participants. Maybe that's the effect you have ? I'm also using a rpi4 4b. But honestly: since the last version of glodroid i tried did not support USB cam at all - i concentrated more on konstas at the moment. With latest konstas i made progress but still have a lot of problems:

  1. my webcam does not work - but logitech c310 (borrowed) works!
  2. the audio of the RPI will not be transfered to the other participants

So i keep watching all options and roms at the moment. The only one that works for me is fydeOs. But i would rather have a "real" android, that's why i try glodroid and konsta.

i wonder: does audio in skype work for you ? do the other participants hear the audio of the RPI? what audio device do you use (bluetooth, webcam-audio ???)

ghost commented 2 years ago

I've understood, unfortunately for me the version from KonstaT is not an option because I am changing things everywhere for my real activity which is this one https://github.com/GloDroid/glodroid_manifest/issues/177

I am using GloDroid with the updated master code + I install Aurora Store to install the app Skype version which you can find from there but USB cams are not seen. the CSI Rpi Camera yes and I am able to call using an USB Audio Set and I hear others and others can hear me without problem, the only thing is the image of the camera which is like a really low resolution but anyway me and others can see it.

Using bluetooth Audio Set there is a further issue because it is seen as a Speaker and not as a HeadSet or HandFree Bluetooth device, which means you ear everything but the mic does not work. This has to be something with the porting of a Client Profile for these two kinds of BL devices which is not in place at the moment. Anyway consider this is an issue in Linux too!