Click here to Skip to main content
Click here to Skip to main content

Use Android Phone as Webcam and Surveillance Camera

, 4 Jul 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Android phone as webcam or remote surveillance camera through Skype


The article describes how you can use your Android phone as webcam or remote  surveillance camera through Skype or VLC Media Player or any other applications that uses DirectShow API. The Android app used here can be found here and the source code is available here.


If you happen to have more than 1 Android phone and you are thinking of how you can make use of the old Android phone besides selling it, then this article is for you.

Using the App and the Source Code

The Android app that I developed is capable of streaming MJPEG. It uses NanoHttpd and extends it to support motion JPEG.

Whenever a video frame is captured, it is streamed as a series of JPEG images as shown below.

private class VideoStreamingTask extends AsyncTask<datastream, void=""> {
	protected Void doInBackground(DataStream... videoStreams) {
		isStreamingVideo = true;
		byte[] data = null;
		while (true) {
			if (!isStreamingVideo)

			DataStream videoStream = videoStreams[0];
			try {
				OutputStream os = videoStream.getOutputStream();
				if (os != null) {
					data = getSnapshot();
					if (data == null)
					os.write(("Content-type: image/jpeg\r\n" +
							"Content-Length: " + data.length +
					os.write(("\r\n--" + NanoHttpd.MULTIPART_BOUNDARY + "\r\n").getBytes());
			} catch (IOException e) {
				Log.e(TAG, "[doInBackground] Error writing stream", e);
			} catch (Exception e) {
				Log.e(TAG, "[doInBackground] General exception", e);
		return null;

	protected void onPostExecute(Void result) {


Look into the Java classes under package you can find the various Java classes that use NanoHttpd to host a web server inside your Android app.

By using the Android app, once you start the control panel, you should be able to access the web interface through Chrome browser. Turn on the surveillance camera and you should be able to view your camera remotely. Click on the Media Information button and you can see the URL for the MJPEG stream.

Image showing URL of web control panel

Control Panel URL


Image showing the MJPEG URL



In order for Skype to use MJPEG, download and install either IP Camera Adapter or IP Camera [JPEG/MJPEG] DirectShow Filter. Below is a screenshot of what you should see in Skype. You should see MJPEG Camera for IP Camera Adapter, or IP Camera [MJPEG/JPEG] for IP Camera [JPEG/MJPEG] DirectShow Filter.

Skype camera


Now with the MJPEG url and also make sure the camera is turned on through the web control panel, open up your Skype.

Perform the following steps 

  • click Tools > Options
  • Under Video settings, choose "MPJEG Camera" (I am using IP Camera Adapter)
  • click WebCam settings
  • Paste the MJPEG url into the Camera feed URL text box
  • click Autodetect to make sure the URL is working (make sure the camera is turned on).
  • click OK if everything is fine.


Skype webcam settings


Change the following configurations to allow Skype to answer video call automatically.

  • click Tools > Options
  • Under Calls, click Call settings
  • Click Show advanced options
  • Tick Answer incoming calls automatically.
  • Tick Start my video automatically when I am in a call



With all the configurations in place, now is time for you to test. Create another Skype id and login using that id from another machine. In my case, I installed Skype in my tablet, and add the Skype id I used with the Android phone. 

Here is what you should see if you make a video call now.


Using VLC Media Player

VLC Media Player also supports network streaming using MJPEG. You can open a network stream and view the video remotely.

VLC media player



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Malaysia Malaysia
A programmer for a long time, and still learning everyday.

A supporter for open source solutions, and have written quite a few open source software both in .NET and Java.

Comments and Discussions

QuestionReg Issue in app PinmemberMember 111342806-Oct-14 21:35 
QuestionSource Pinmemberlink1112-Sep-14 8:55 
AnswerRe: Source Pinmembertwit883-Sep-14 0:32 
QuestionAwesome idea and ... PinprofessionalAfzaal Ahmad Zeeshan17-Aug-14 4:03 
GeneralMy vote of 5 PinprofessionalMihai MOGA13-Aug-14 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.1 | Last Updated 5 Jul 2014
Article Copyright 2014 by twit88
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid