-
Notifications
You must be signed in to change notification settings - Fork 72
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
UVC Support #38
Comments
Commit 5aaf88d fixes a few things in the UVC function. Now android-usb-gadget is able to create a UVC gadget which works with "uvc-gadget" (https://github.com/wlhe/uvc-gadget). Tested with Pixel 5 and self-build Kernel. uvc-gadgetCompiling uvc-gadget for arm64sudo apt install android-tools-adb android-tools-fastboot git
curl -O http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
unzip android-ndk-r12b-linux-x86_64.zip
./android-ndk-r12b/build/tools/make_standalone_toolchain.py --arch arm64 --install-dir ~/arm
git clone https://github.com/wlhe/uvc-gadget
cd uvc-gadget
~/arm/bin/clang -pie uvc-gadget.c Transfer the "a.out" bin to your target device. Using uvc-gadgetI was not able to get uvc-gadget to work with any of the camera video device files. It seems that v4l2 on Android has a different specification than on generic Linux. chmod +x a.out
./a.out -i /storage/emulated/0/test.mjpeg -u /dev/video5 -f 1 -r 1 With this, the Android device gets detected as a UVC Webcam under Windows 10 and plays the mjpeg video in a loop. USB ToolI attached a signed interims version of android-usb-gadget with the fixed UVC function. |
After successfully enabling the UVC function using USB Gadget App, I am not able to write to
Steps I have taken: 1. Enable wifi debugging so we can use the USB for UVC only In terminal On the Rooted Pixel 4A with custom ROM/Kernel (thanks @tejado 🙏 )
On my computer computer:
2. Configure UVC function in Android USB Gadget Select +, UVC, enable it 3. Set the permissions for newly created
Thanks again @tejado for the 4. On another Android app, grab the camera frames as following I get 24 frames per second using imageAnalyzer from CameraX:
convert the 3 YUV planes to ByteArray
Then based on UVC Specifications I build the header of the frame:
Add all of the above to the header
Open the FileOutputStream and try to write the header and the image:
Getting I tried to break down the imageByteArray into smaller chunks and write to the FileOutputStream by leveraging the To test the UVC stream file and ensure it is writeable, I used the FFmpeg Android Library Running their sample app with the following command:
FFmpeg suggests Compared to / Next steps/ideas:
|
dead chat xd |
@luchfilip |
Related:
|
This issue documents the work to get UVC up & running with android-usb-gadget.
The text was updated successfully, but these errors were encountered: