Nexus 7 Webcam attached update

I forked the original simplewebcam app by neuralassembly and added the mode change (chmod 666 etc.) to the application itself.
When using the application you will thus be prompted to allow super user rights.

If you already installed the original simplewebcam app you will have to remove it first before installing the new app.

Please be advised that this app is provided without any warranty.

Howto

Required:

  • USB OTG Cable
  • Webcam with moderate power consumption (tested with Logitech – C500 )
  • Rooted Nexus 7
  • forked Simplewebcam App  (Download apk)

1. Plug in your Webcam to the Tablet

2. Start Simplewebcam App

3. Grant Superuser rights when prompted

4. You should see your Webcam output

Troubleshooting

In case the above instructions do not work for you please follow the steps in the previous post to make sure that the webcam works.

 

 

 

About these ads

43 responses to “Nexus 7 Webcam attached update

      • sorry but i dont have any knowledge about android programming :(
        i am only an end-user :). i will use simpledoublewebcam with my n7 in my car as a rearview mirror and trip camera.

  1. I like your edit in the imageproc and I do wonder how the original writer of the program didn’t think about it. Well, my problem is that I can’t get the double cameras to work although each one of them works perfectly with the simplewebcam app. Any clue what this could be?

    • Thanks. My guess is that you are either using a usb hub that causes the problem, I had that a few times already, or you have power issues with the two cameras. Can you plug the cameras in one by one with the usb hub and check if the device nodes get created ? Also check dmesg for problems.

  2. Thank you for your quick reply. I use a usb hub with external power supply and actually both nodes get created “video0 and video1″. I tried using the usb with the simplewebcam app and it works fine.

    • Ok, without actually having a setup for testing at hand it is hard to further diagnose the problem. I plan to work with a stereo camera setup eventually but currently I can’t help you. When I have something up and running I will open a new post.

  3. Sorry, it seems I didn’t follow the exact sequence. When I followed the exact sequence of plunging camera before starting the app, I could see the camera output. I have observed another problem , if i remove the camera and reattach it while app is running, I couldn’t get the output, even, I close and restart the app.I have to restart the tablet. If, I close and open the app when the camera is connected, I didn’t get any problem. It seems camera should be connected before the app is on.

  4. Does the camera work when it is connected to USB hub? The set up is as follows TAB to OTG cable to usb hub then one connection to power source and other to camera.

  5. Thank you,
    It is not working with my hub.I will try some other hub.
    Have thought about my other question?

    • The app is not plug and play capable it requires the camera to be plugged in before you start it. When you remove it while it is running you will indeed run into problems. I tried it and there seems to be some kind of timeout for the device node. You do not need to restart the whole tablet just give it a minute, close the app. When you plug in the camera and start the app it should work again.

  6. Thanks for your work! I’ve a problem:
    I downloaded your source code, but when I compile it and install the apk, doesn’t display the super user window to start.

    Any help is welcomed! Thanks!

    • Hi Victor,

      have you checked that you have ‘su’ installed ?
      Also look at the logcat output off the app it should tell you if there are problems and what the problem might be.

      • SuperSU should work. You don’t need to add it anywhere else. The apk I provide here is the direct product of building the source project. If the apk works for you but building from source doesn’t I would be very interested in having a look at the logcat output when you run your apk. If you want I can also check your apk, just send it to droidperception@gmail.com .

  7. Thanks for your app, which I downloaded and installed. It works flawlessly with my rooted nexus 7, and it gave me enough curiosity to explore a few configuration files and google around to see if I could make the usb camera work with the native camera app. After some reading and some tweaking, I am now able to use my cheap trust usb webcam with the native camera app, for both picture taking and video recording. I edited /etc/media_profiles.xml and added a configuration section for the additional camcorder profile with cameraId=”1″ and proper encoder profiles (which to be honest I still do not fully understand), saved and rebooted with the usb camera attached. Bingo!

    • Thanks, I really appreciate your effort it sounds great! would you be willing to make a short how-to that I can post here or do you have one I can link to ? There are probably quite a few people here who would be interested in it.

  8. OK, but I have to say that this mod is not what I would call “professional”. Far from it, as I do not have the skills.only

    I have a nexus 7 32gb wifi, stock rom JDQ39. Bootloader unlocked and rooted. My webcam is the one you find in the Trust Exis Chat Pack, max resolution 640×480 and uvc compatible.
    The webcam can be attached before booting (“BB”) or after (“AB”). Simplewebcam works and lets me access the webcam both ways. Fast Burst Camera works, but I can see both built-in and usb camera only in the BB case, otherwise it’s just built-in. The native camera app is the most problematic, because in the BB case it crashes and in the AB case it works but lets me use the built-in camera only.
    I can experience the above behaviour even when I add a line to /etc/nvcamera.conf that reads like “usb=/dev/video0″ (or anything else I could think of, for that matter) which some say works [see Steven Archibald’s google+ posting]. So I left that file in its original state.
    What I did instead was to edit the /etc/media_profiles.xml, in the following way.

    I copied the whole section beginning with the tag and ending with the tag .
    Pasted it right underneath.
    Changed the tag to .
    So I had two CamcorderProfiles, the first for cameraId=”0″ and the second for cameraId=”1″.
    Then I examined all the subsections in the second profile, kept the ones I thought were ok for my webcam and deleted the others.

    Now the native camera app (BB case only) lets me see both usb and built-in cam and I can shoot pictures or take videos with both of them.
    Problems: the usb camera preview is ok when holding the tablet in portrait position and does not rotate when holding the tablet in landscape position. Some apps just don’t work: AutoGuard Blackbox and Car Blackbox for instance.

    PS: the media_profiles.xml I had was NOT the original one, because of the 720p video recording hack: http://forum.xda-developers.com/showthread.php?t=1868962

    I truly hope this helps. Cheers!

  9. For some reason tags were deleted in my previous post. I’ll try again:

    I copied the whole section beginning with the tag -CamcorderProfiles cameraId=”0″- and ending with the tag /CamcorderProfiles.
    Pasted it right underneath.
    Changed the tag to CamcorderProfiles cameraId=”1″.
    So I had two CamcorderProfiles, the first for cameraId=”0″ and the second for cameraId=”1″.
    Then I examined all the subsections in the second profile, kept the ones I thought were ok for my webcam and deleted the others.

    Sorry, feel free to edit as you please.

  10. Thanks for this program! Using in my car as a backup cam. Is there any way to mirror image? I need this so it functions as a true backup camera.

  11. Are the following possible by a webcam connectd to nexus 7?
    1. Snap images and Shoot videos
    2. Chat (a hangout or skype)

    • In short, yes. Slightly longer snapping images is already possible with the simplewebcam app, see the newest version. Video shooting will be supported some time soon. The aim of this modified version of the simplewebcam app is to have maximum control over the cam without a special rom. Root is unfortunately required. Skype would require further modifications on the rom afaik and is thus not an aim right now.

  12. Pingback: Video Tutorial On How to Use Your Gamepad, Keyboard and Mouse on Android Phones with USB On-The-Go·

  13. I was playing around with the original app dated 2013-04-17 and found it will work with an un-rooted original Nexus 7 if you set camera permission in the manifest. It does not work on the new N7. I tested it with a couple cheap plumbing drain cameras, a Logitech C310 and C920.
    added:

  14. I confirmed that it will also work with your latest code on the original N7, non-rooted. I just copied the lib folder from the old code into the latest, and set the user permission to CAMERA and it works great. I am running Android 4.3. Great job! With a little more work, I think you have something worth putting in the play store.

  15. I have it working on my S3 and my new 2013 N7. All I had to was look at the /dev directory and see which video# file shows up when you plug in a camera and set the cameraBase to it. You can probably make this automatic by changing the checkCamerabase function in the c code. I would also look into using the Android usb.hardware to detect the camera and capabilities of it. I hacked the adbTest sample app output the usb info to logcat. A camera clearly shows up as a class=239, subclass=2, protocol=1 along with the name. It looks like Android also supports the v4l2 as a video4linux2-1:1.0 file shows up in /dev/usb when a camera is plugged attached. It should not be a problem to get higher resolution and control the brightness and contrast. I would love to do this, but right not I am working 60+ hours a week. I you would like to chat, send me and Email through XDAdev. Dan

    • Hi Dan,

      thanks for the input! That is a whole lot of info there. Yes, adding higher resolution and making a proper call from java to jni for the camera interface are things I’d also like to do but right now adding the video recording is my top priority. After I get that properly released we can talk about those features. Regarding the camera permissions, I did try that already but it didn’t work on my N7 version 1 without setting the device node permissions with root. If you are certain it works i’ll have another look into it. There is little documentation but I always assumed that the permissions indeed translate to groups (e.g. video) on the native userland level.

    • Any chance you could elaborate on what you did for the new N7? I have a rooted one on build JSS15J and a logitech c250. I installed the latest apk but just get a black screen. Also when I opened the app I never got prompted for SU access even though I have SuperSU installed. I’m pretty tech savvy but am a android/Linux noon so lamens terms would be nice.

  16. I noticed your target is set to 8 in the source I cloned. Is this just that you did not update the properties? If you are going to store videos, you may want to set it to at least 11 to do H264 encoding or your files could be quite large.

    • The project this is forked from was initially for Android 2.2 thus API level 8. I thought about moving it to API level 14 as the aim was to make it run on the N7 but chances are that it also works on other devices and until now, with video there was no real need to use a newer API. Obviously older devices will have problems with video encoding so it will indeed make sense to move to 11 or even 14.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s