SimpleWebcam App

Latest Release:

Version 5

For Android version < 4.4

apk | source code

– removed super user system call

– added camera permissions to manifest

Version 4

For Android version 4.4(KitKat) or newer
Requires Super User rights (rooted device)

apk | source code

– added portrait mode

Version 3

apk | source code


– added video stream flipping option in menu

Version 2

apk | source code


– added image taking capability

Version 1

apk | source code

40 responses to “SimpleWebcam App

  1. I love what you’re doing here. Anyone successful using this on an ASUS Transformer TF300T? I’m a noob and haven’t figured it out. I’ve tried the USB connection kit and the dock usb ports and no luck.

  2. Pingback: Webcam on Unrooted Nexus | droidperception·

  3. Hi, Droidperception ! Thank you a lot for your project – it is very interesting.
    But i got a problem. When i download SimpleWebCam_fork.apk (vesion 5, from this page) i have no problems.
    When i download master or release source code – application do not work. I have black screen – application freezes at onCreate
    I am using usuall ADT Bundle, nothing special.

    And when i am trying to install one over another variant (.apk over compiled) i get message about signature conflict.
    Are .apk version and source code the same thing ?

    I have no idea what to do. May be you have ?)

    Thx a lot !

    • Hi,

      please use the release branch. It is always consistent with the apk’s that are published. Can you use the Eclipse debugger / Logcat to figure out what is going wrong? Freezing should not happen.

      Regarding the signature conflict. Apk’s are always cryptographically signed either with a debug or a proper release key. My release key is different to yours that is why you can’t install one over the other.

  4. Hello DroidPerception,
    I just wanted to thank you for your hard work on this application. I was able to compile the code and install it successfully on the (old) nexus 7 (not rooted), but not on the new nexus 7 or the S3. I saw Dan’s comments and his code where he was able to get it to work on the new N7 and S3 using the for loop. I tried it with no avail. I am playing with the code now and getting familar with how it works. Please let me know if there is anything I can help you with. Thank you again for your hard work on this project.

  5. thanks for the great app.
    is there a way to get full screen video. right now video is only showing up on 2/3rd of the screen.

  6. @ Stephan the for loop to detect the correct /dev/videox device in the JNI part of the code won’t get called with the current variable initialisation (to 0) of cameraBase in class. Change the code to following for it to work:

    // /dev/videox (x=cameraId+cameraBase) is used.
    // In some omap devices, system uses /dev/video[0-3],
    // so users must use /dev/video[4-].
    // In such a case, try cameraId=0 and cameraBase=4
    private int cameraId=0;
    private int cameraBase=-1;

  7. @ doedoe The code can be modified to get a more full-screen video by setting a 16:9 aspect ratio in the video scaling code in class and holding the tablet in landscape orientation. In the VideoHandler class change the current code to following:

    //obtaining display area to draw a large image

    scale_x = ((float)(dw+winWidth-1)/(float)CameraPreview.IMG_WIDTH);
    scale_y = ((float)(dh+winWidth*9/16-1)/(float)CameraPreview.IMG_HEIGHT);
    scale_x = ((float)(dw+winHeight*16/9 -1)/(float)CameraPreview.IMG_WIDTH);
    scale_y = ((float)(dh+winHeight-1)/(float)CameraPreview.IMG_HEIGHT);
    canvas_pos_scale.setScale(scale_x, scale_y);

  8. thanks john.
    first time actually modifying and compiling an android app and it works. now is there a way to change the resolution instead of just stretching the video?

  9. Perhaps this is a question that shows I have not installed apps from outside the google play store often. The apk link does not have an apk file but rather a zip file with a number of files and no apk. How do I load this.

  10. Thank you John! I am going to try this and see how it works. I will get back to you with an update soon. @csrguth you can click the link labeled apk at the top of this page right under where it says version 5 to the left of he source code link which I think you might have selected. A link to the apk can be found below:(
    Download that apk and then install on your nexus device. You may have to enable developer options to install an app not from the play store.

  11. Developer implemented. When email the zip file to the tablet it says I cannot open or view this type of file.
    When I attempt to download and open directly from the Web page to the tablet I receive this. This XML file does not appear to have any style information associated with it. The document tree is shown below.

    Access Denied


  12. @John, Even with cameraBase set to -1 the image will not show on the new N7 or S3. It selects the correct video source but no image. :/ I must be missing something… Any ideas?

    • @ Stephan not sure about new N7 could be an issue due to the inbuilt front & back camera unlike older N7. By rebooting older N7 while usb camera is plugged in it actually detects the camera as a Main camera without rooting or changing /etc/nvcamera.conf! Got it working at times using “Camera MX” software (choose camera under options) from google play store & disable then renabling camera using a “Camera Disable ICS” software from google store. Im trying currently to add video recording to simplewebcam source. Wonder how @droidperception has done it (can’t use MediaRecorder class in Android cos it isn’t registered as a Camera for HAL to kick in)

      • John have you managed to get video recording working? If so, would you mind sharing you how got it working? Thanks!

  13. @John. Thank you for your help. I was able to successfully run the webcam with Camera MX. The system recognizes the webcam as the main camera on boot. Does not work on the new N7 though. Neither are rooted. I am thinking about rooting the new N7 and changing the permissions of Video3 to 666 and see if that makes a difference. Ill keep at it and let you know of any updates. Thank you again for all your help!

  14. Pingback: Webcams on Android 4.4 | droidperception·

  15. Hi, first of all thanks for your fantastic work. I downloaded source code of version 4 and was able to get it to work on my rooted nexus 7 2013 – KitKat KRT16S by forcing use of /dev/video3: as you suggested to Stephan, I modified with CameraBase=3.

  16. Hi! My camera detected as dev/bus/usb/001/002, 003, …00x
    What can I do?

    Lenovo P780, Android 4.2.1, P780_8G_ROW_S119_130930

  17. I have a rooted N7 2013 on kitkat, using CameraBase = 3.

    The Logcat gives me “Could not su 12 : Out of memory”. I added the property android:largeHeap=”true” to the manifest and it works occasionally but not always. Is this a known error?

    • It is not a known issue so far. Having an out of memory error is also something I would not expect there. The error is from line 53 in ImageProc.c .All that is done there is make the system call which should not require a huge amount of memory.

  18. hi i am use your code.but it make some error like buffer not initialized and also the following error ” VIDIOC_S_FMT error 70, Communication error on send ” .so anyone help me this problem.

  19. Nexus 7 2013 wifi (rooted running Android 4.4.4)
    I wonder if someone here can help me?
    Its probably best if I describe what I want to do.
    I want to attach a microSD card and an external webcam. I also want the N7 to be powered.
    The idea is for the webcam to make recordings and store them on the microSD card.
    (I bought a 5 in 1 from through Amazon but the N7 doesn’t recognise anything.)

    • I don’t have the exact answer you want but I did something similar that you might find useful.
      I use a rooted Nexus 7 (2013), Android version 4.4.2 with a USB snake camera as an inspection camera with recording capability.
      Needed software and hardware accessories:
      – Dashcam App version 4 (but showed as version 1.10 under app info)
      – OTG cable (Amazon Store ID # B00DQ5RYP0)
      – HooToo USB 3.0 hub model HT-UH007 (ASIN = B005QX7KYU)
      – USB snake camera (DealExtreme SKU = 173759)
      – Power off the Nexus 7
      – Connect the USB camera to the Nexus 7 via the OTG cable or via the USB hub connected to the OTG cable.
      – Power on the nexus 7
      – Run the Dashcam App and it will recognize the USB camera and display real time video.
      Note_1: Nexus 7 will not recognize any USB camera if it wakes from sleep mode.
      Note_2: Not all USB hubs work. I used a couple of cheap USB 2.0 hubs and none worked (they worked for USB drives but not USB webcam). The HooToo model listed above worked fine with the USB snake cam).
      Note_3: The Nexus 7 can power the USB snake cam without the need for external power.

      For saving files on an external USB drive, I use Stickmount App version 3.10.

      Unfortunately, Dashcam saves pic and video to a fixed location:
      Maybe a future version will allow the file location to be specified by the user.

      Good luck.
      Ares Kenlin

  20. Hi,
    I Ran this code Sucessfully. but the camera preview was in the left side of the activity.but i want to display the preview in the center of the to do this…please reply

    • Hi,
      you may have to change the layout settings under res/layout and res/layout-land.
      There are options to center elements horizontally and vertically that you can use to tweak everything.

    • Hi Ashwin,

      I had same problems “VIDIOC_S_FMT error 70, Communication error on send ” and ” Unable to load frames, buffer not initialized”
      why this error is generated and how to solve that….???

      please help me.

  21. Hey Guys! Excelent project! I want to know what webcam do u used, because the one that i am using itsnt working. thnks

  22. Pingback: Evolution of inexpensive videolaryngoscopy: from concept to practice | Prehospital and Retrieval Medicine – THE PHARM dedicated to the memory of Dr John Hinds·

  23. I tryed the last one revision that dont need root, but the app note thats no camera. What can be?
    Obs: I tryed another app too that could open, so i think my smarphone are compatible. I have a Motorola Moto G3, and a Logitech c920

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s