openxc / android-webcam Goto Github PK
View Code? Open in Web Editor NEWAndroid library to access a USB webcam feed
License: BSD 3-Clause "New" or "Revised" License
Android library to access a USB webcam feed
License: BSD 3-Clause "New" or "Revised" License
I use your code to display a usb webcam with Nexus 7, the video is displayed is very good, but it is YUV420 , I would like enabled full HD 1080p, to do that we need h264 compression, when I activate the code with <fmt.fmt.pix.pixelformat=V4L2_PIX_FMT_H264;> I have a green display and the app crash after 20 seconds,
I think we need a method to convert h264 to rgb instead of yuv to rgb;
how can I activate this mode h264 ? and thank you in advance;
Hi !
When I run the example I have this "Insufficient permissions on /dev/video0 -- does the app have the CAMERA permission?" in the console.
I have check the permission in the manifest and I have also check the permission in adb:
"crw-rw---- system camera 81, 1 2014-09-11 21:15 video0"
thanks in advance
Hi, I wonder if this will work with a video as an input too. Is that possible? or v4l doesn't support it?
Did anybody successfully manage to make this app build in Android Studio? I tried to use the import dialog, got the gradle files and hoped that after fixing some things, it would build. But it didnt.. Of course I did something wrong. Any suggestions on how to import it and do the maven stuff?
Thanks!
How many cameras can be connected at same time?
Hi,
When I run the example I have this error:
5602-5627/com.ford.openxc.webcam E/NativeWebcamJNI﹕ Unable to load frame, buffers not initialized
Any idea?
Thanks
i am getting an error while starting the application.
NativeWebcamJNI(2427): VIDIOC_DQBUF error 9, Bad file number
this error keeps repeating. There is no other message of error that I see.
Having trouble getting this to work, either permission issue, black screen, locks device, or reboots device.
Want it to work on Galaxy Note 1 (n7000), tried a couple of ROMs: Slimbean and ParanoidAndroid 4.2
Thanks
Hello,
i habe compiled the app and set the permissison to 777 and Media\Camera of the node video0. Im using a Sony Xperia Go Device (Firmware JB). When I lunch the app, I get the following error:
dmesg Shows: failed to submit urb0 (-28)
and /proc/last_kmsg shows:
Mali: Session started
Init: Untracked pit 12759 exited
Send sigkill to 12584
State 0 ...
Any suggestions?
Peter
Thanks for codes,
Can we use it directly as it is licensed.
Thanks
I have used the example and nothing is showing up on the screen, just a big black rectangle. On Android 4.4.2 with V4L2 enabled. I am thinking it is because there is no reference to the "cp" custom view in the .xml file. However, where would I put this if I wanted it to show up?
Will it work with none YUV camera like a monochrome camera ?
A tip from Borja:
I write you again because finally i managed to have external webcam working on my device. I's not a v4l2 related problem. I's because samsung devices do not have uvcvideo module in their kernel. All new devices have v4l2 intalled in kernel but not uvcvideo.ko that is the driver (module) to get comunication between linux kernel and uvc compliant web camera.
I had to recompile a custom kernel to enable USB_VIDEO_CLASS option. With new kernel i have no problems to get frames from my camera with an app named dashcam. Now i'm going to test openxc/android-webcam to try get video in my app.
I get
NativeWebcamJNI: Cannot open '/dev/video0': 11, Try again
and then
NativeWebcamJNI: Unable to load frame, buffers not initialized
what is 11? why try again? I'v tried...
p.s.
Android 4.3, rooted
permissions are fine:
crw-rw---- media camera 81, 0 2017-02-19 04:11 video0
Anybody help
I am not a developer and i am looking for solution to connect an external camera to unity3d.
I would like to know if this library it's a good starter to make a bridge between android and unity 3d ?
Hi Folks,
After building this project I am getting this error.Even I changed the package name, but still getting this error.Please provide me the solution.
Thank You!
Process: com.ford.openxc.webcam, PID: 20416
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.ford.openxc.webcam-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libwebcam.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.ford.openxc.webcam.NativeWebcam.(NativeWebcam.java:26)
at com.ford.openxc.webcam.WebcamManager.onCreate(WebcamManager.java:28)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2763)
at android.app.ActivityThread.access$1800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
The example app is working fine on a Nexus 7 running 4.2.2 with kernel version 3.1.10-g05b777c (build number JDQ39). The /dev/video0
device pops up owned by the camera
group and opens correctly in the application.
On the Nexus 10 running 4.2.2 with kernel version 3.4.5-gaf9c307 (build number JDQ39) no new video device appears when the camera is attached. There is an error in the log:
07-23 09:28:53.322: W/ContextImpl(388): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1032 com.android.server.usb.UsbSettingsManager.deviceAttached:619 com.android.server.usb.UsbHostManager.usbDeviceAdded:156 com.android.server.usb.UsbHostManager.monitorUsbHostBus:-2 com.android.server.usb.UsbHostManager.access$000:38
I'm not sure if this is actually indicative of a problem, or just a red herring.
On the Nexus 7 v2 I needed to change the device name to /dev/video3
Hello,
Not really an issue, but is it somehow possible to get a .jar or .aar file from this project? I have no clue on how to do this.
Thanks!
See #5
The device gets mounted at /dev/video3, but fails deviceFile.canRead in NativeWebcam.
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ webcam-example ---
[INFO] Building jar: /home/deval/android-webcam/example/target/webcam-example.jar
[INFO]
[INFO] --- android-maven-plugin:3.6.0:apk (default-apk) @ webcam-example ---
[INFO] Enabling debug build for apk.
[INFO] /home/deval/Android/Sdk/build-tools/27.0.3/aapt [package, -f, -M, /home/deval/android-webcam/example/AndroidManifest.xml, -S, /home/deval/android-webcam/example/res, -S, /home/deval/android-webcam/example/target/unpack/apklibs/com.ford.openxc_webcam_apklib_1.0/res, --auto-add-overlay, -I, /home/deval/Android/Sdk/platforms/android-17/android.jar, -F, /home/deval/android-webcam/example/target/webcam-example.ap_, --debug-mode]
[INFO] /home/deval/Android/Sdk/tools/apkbuilder [/home/deval/android-webcam/example/target/webcam-example.apk, -z, /home/deval/android-webcam/example/target/webcam-example.ap_, -f, /home/deval/android-webcam/example/target/classes.dex, -rf, /home/deval/android-webcam/example/target/classes, -nf, /home/deval/android-webcam/example/target/libs, -nf, /home/deval/android-webcam/example/target/unpack/apklibs/com.ford.openxc_webcam_apklib_1.0/libs]
[INFO] /bin/sh: 1: /home/deval/Android/Sdk/tools/apkbuilder: not found
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Android Webcam Example
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Android Webcam Example
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.872s
[INFO] Finished at: Tue Apr 03 12:24:14 IST 2018
[INFO] Final Memory: 25M/358M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:apk (default-apk) on project webcam-example: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/deval/android-webcam/example && /home/deval/Android/Sdk/tools/apkbuilder /home/deval/android-webcam/example/target/webcam-example.apk -z /home/deval/android-webcam/example/target/webcam-example.ap_ -f /home/deval/android-webcam/example/target/classes.dex -rf /home/deval/android-webcam/example/target/classes -nf /home/deval/android-webcam/example/target/libs -nf /home/deval/android-webcam/example/target/unpack/apklibs/com.ford.openxc_webcam_apklib_1.0/libs, Result = 127 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Hi, guys
I'm trying to use this lib for saving frames into memory.
I've changed only run method of WebcamPreview class
Bitmap bitmap = mWebcamManager.getFrame();
Canvas canvas = mHolder.lockCanvas();
if(canvas != null) {
drawOnCanvas(canvas, bitmap);
mHolder.unlockCanvasAndPost(canvas);
}
FileOutputStream out = null;
try {
out = new FileOutputStream("/storage/sdcard0/DCIM/1.png");
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
Also I've removed the cycle, so I get only one frame and save it.
All other things are unchanged.
I've set user to media for webcam (it is on video2, not on video0) and group camera(It was root).
crw------- media camera 81, 2 2015-02-19 22:39 video2
But I have only black rectangle 640*480 instead of the saved frame.
Maybe I've missed something?
Hi,
I tried to compile your example and I am having problems getting it to run. When I can see the line "Insufficient permissions on /dev/video4 -- does the app have the CAMERA permission?". I am sure video4 is the right device since it appears only when the camera is attached via USB.
I did not change anything else in the library or your example. Any idea on how to resolve this?
Thank you!
I'm trying to get this working on a Razr Maxx HD. First, I had to change the webcam input to /dev/video4 (neualassembly's code had something in there to automatically choose the device, I've ported that over in my code).
Now that it's reading the correct device, I get this in rapid succession:
VIDIOC_DQBUF error 19, No such device
So it's creating the buffers correctly, but when it goes to read data it can't find the device. Anyone know how to resolve this issue? Is it possible that it's the same problem as the Galaxy Nexus (not have enough power to start webcam?) Would a OTG powered USB hub resolve this?
If you disconnect the camera, the service never really shuts down, it just starts getting failures at a very high rate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.