Nov 5, 2010

Howto: use your iPhone as webcam in Linux (without WebcamStudio)

So this is the story - my laptop (yes it's a bit of a relic) doesn't come with a webcam. While I do have one of those tiny USB webcams, it has never been very reliable. It sucks in low-light, and the resolution is shitty at best - and don't even get me started on those wires. As is the case with many such stories, necessity thus drove me to find this nifty little solution.

I found a nice little app on the AppStore called iWebCamera which sounded like it could do just the trick! according to their website, iWebCamera could stream the images/video from you iPhone's camera to your computer. The catch here of course, is that you need their "driver" software installed on the computer. This is all fine..if you're on a Mac or Windows machine. Linux users aren't completely left out though, as the very handy "WebcamStudio" does support iWebCamera. However, the problem is that the current version (0.56 at the time of writing) doesn't support v4l2 (which I needed for skype compatibility)

*note; v4l2 support in WebcamStudio is coming in the next release. You're welcome to wait until it comes out. I did it this way because I didn't need the extra features WebCam studio.

let's get started after the break!




This tutorial is based on Ubuntu 10.10 running kernel 2.6.35-22-generic and relies on gstreamer

First you'll obviously need iWebCamera installed. Then you'll need to know the ip-address of your iPhone (which you can find in settings). Did I mention that this only works over WiFi?

next on your linux machine, get ready to compile some stuff!

grab the dependencies
sudo apt-get install build-essential libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libtool autoconf mercurial gstreamer-tools git
after that, you'll need to grab both the V4l2 Loopback drivers, and the corrosponding helper utility.
hg clone https://v4l2loopback.googlecode.com/hg/ v4l2loopback
git clone http://github.com/umlaeute/gst-v4l2loopback.git

first we compile the loopback driver and install it
 cd v4l2loopback && make
sudo make install

If everything went well, you should be able to load the kernel module
sudo modprobe v4l2loopback

If you were successful, you should have a new loopback video device at /dev/video0 or /dev/video1 etc...

next, we compile and install the gstreamer sink

cd ../gst-v4l2loopback && ./autogen.sh
make && sudo make install

now if everything went well, you should be able to do a "gst-inspect v4l2loopback" and get a description of the v4l2loopback gstreamer plugin.

That's all for the compiling. Now all you have to do is guide the webcam stream from the phone through a gstreamer pipeline (and hence through appropriate decoders) all the way to the v4l2loopback sink.

gst-launch souphttpsrc location=http://192.168.1.11:8080/strm ! jpegdec ! ffmpegcolorspace ! v4l2loopback device=/dev/video0

where 192.168.1.11 is the ip address of your iphone on the network, and /dev/video0 is your loopback device. If everything went according to plan you should now be able to use the "iPhone webcam" for skype and other programs.



This path offers massive flexibility and configurability. You could push the stream through some effectv plugins to get all sorts of cool animations and effects. You could also stream movies,videos,screencasts etc over skype. I'd like to see them do THAT in windows :)

26 Comments:

Anonymous said...

nice trick.

Anonymous said...

cool, thanks for sharing! do you know how to change resolution? I tried guvcview and it sees only 320x240. I have an iphone4

SoE said...

I'm not sure. I guess you could pipe it through videoscale although that wouldn't help video quality much... I think the stream itself is of a limited resolution from the app side. I'll look into it and see if i can dig something up.

Anonymous said...

Hey. just found you on Google. This is awesome! Works like a charm. I never knew of v4l2loopback and I'm really loving it!

David Moraes said...

Could somebody please help me? I am getting this error when running gst-launch souphttpsrc location=http://192.168.my.ip:8080/strm ! jpegdec ! ffmpegcolorspace ! v4l2loopback device=/dev/video0

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
Setting pipeline to NULL ...
Freeing pipeline ...

And Skype does not detect my webcam. I think v4l2loopback uses /dev/video1 on my computer but gstreamer itself uses /dev/video0? Would that make any sense? I've tried replacing the command with /dev/video0 and got the same error.

Anonymous said...

Thanks a ton for this. Just wanted to note a small typo. Missing an 'o' in autogen.sh:

cd ../gst-v4l2loopback && ./autgen.sh

should be

cd ../gst-v4l2loopback && ./autogen.sh

Thanks again!

SoE said...

thanks for the correction there.

@David: I had the problem too for a bit. fiddle around with it a bit. Maybe you missed something up there. I'll have a look into it when I get some time

Dencie said...

I have the same problem that David Moraes have...
I don't understand why... I was able to have one image from my 3GS to Skype but just one and one time.

Denice said...

Problem auto-solved :-D
Thanks for the How to...

Manny said...

This is very cool. Great job!

-Manny/drahtwerk

strange1712 said...

Thank you, this has been useful!

Danni1010 said...

This post is over a year old and it still helped me connect my iPod touch as a webcam via WiFi. I am running Ubuntu 11.10 and an iPod touch 4g on iOS5.

SoE said...

thanks for the update. You should also look into webcam studio..

Unknown said...

Just used this little tutorial to connect my Android device via the IP Cam app to Skype. Works great! Thanks!

Anonymous said...

Thank you so much for this tutorial!

Anonymous said...

When someone writes an paragraph he/she maintains
the thought of a user in his/her mind that how a user can be aware of it.
So that's why this article is perfect. Thanks!
Look at my webpage : teen sex videos

Anonymous said...

Howdy! I simply would like to offer you a huge thumbs up for your great information you've got right here on this post. I'll be coming back to
your blog for more soon.
My website > Renna Masturbation

Anonymous said...

I do believe all of the ideas you have offered in your post.
They're really convincing and can certainly work. Nonetheless, the posts are too quick for newbies. May you please lengthen them a little from subsequent time? Thanks for the post.
My homepage : daily xxx video fix of teen porn with naked girls sex movies

Anonymous said...

For hottest news you have to go to see web and on internet I found this site as a best web site
for newest updates.
Here is my web blog teen porn

Anonymous said...

If some one desires to be updated with hottest technologies therefore he must be pay a visit this web page and be up to date everyday.
my site :: vidacup coffee

Anonymous said...

I don't know if it's just me or if everybody else experiencing problems with your website.
It looks like some of the text on your posts are
running off the screen. Can somebody else please provide feedback
and let me know if this is happening to them as well?
This could be a issue with my internet browser because I've had this happen before. Appreciate it
Also visit my blog : top friv games

Anonymous said...

Hi there to every one, it's truly a pleasant for me to pay a quick visit this website, it consists of precious Information.
Stop by my site : check now

Anonymous said...

Have you ever thought about adding a little bit more than just your articles?

I mean, what you say is important and all. However think about if you added some great photos or video clips to give your posts
more, "pop"! Your content is excellent but with
pics and videos, this website could definitely be one of the best in its niche.

Fantastic blog!
My web site :: free royal caribbean cruise

Anonymous said...

does this work in iphone 5s?

Anonymous said...

ecig forum, best electronic cigarettes, smokeless cigarettes, smokeless cigarettes, electronic cigarette, vapor cigarette

Swiss Replica Watches UK said...

Movado means that 'always within just motion' and that is exactly the most essential technique guiding any Movado witness created. Across 1900, Achille was granted all the gold medal considering the Paris, italy faux montres omega General Situation, and now as soon as possible achievement, shortly fater she or he began working with his or her brothers and sisters and initiated emphasizing modernizing that production way and solutions to enhance cheap fake Breitling watches all the complex expertise along with imagination. While Achille generate an alternative factory and modern afternoon equipment, his good friend Isacc Imitation de qualite Bell & Ross Ditesheim borrowed four-legged friend. In Swiss Replica Watches UK 1905, Achille's profession witnessed an alternative landmark as soon as Movado is selected given that the brand with the business. Movado womens and you will be able designer running watches obtained the manufacturer much alot more awards for instance the 1st Rare metal medallion with the General Reveal within Cheap Replica Watches Leigo.

Post a Comment