Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get webcam stream on Mac Os X in Java [closed]

I would like to get the webcam stream of my Macbook (the integrated iSight webcam).

I use Java, and I don't know anything about Objective-C so I'm looking for a "full-java" solution. I found some class example, but they were made in 2005 and they don't work on my system.

like image 624
Matthieu Napoli Avatar asked Sep 20 '10 10:09

Matthieu Napoli


Video Answer


1 Answers

I come across the same thing myself now. I am using VLCJ for my project and it works perfect on Windows, Linux Mint, Linux Ubuntu and Mac OSX Lion. As you probably read, VLCJ is a java wrapper around libvlc which VLC player also uses.

The thing is that when you open VLC player's capture option it populates combo-box with available cameras (USB connected). But that is something which VLC player does only for itself, it doesn't give you API for that. And if you don't pass some camera's ID to it with VLCJ, VLC will use system's default camera. I use VLCJ to stream from USB connected cameras or desktop to file.

I had to find a way to "scan" USB cameras on my system and that is something that is OS specific.

On windows I use DirectShowJava.

On Linux you just need to read /dev/video* for available cameras and if you want to display to user some "user friendly name" you can use video4linux4java

And 3rd and the one that you are most interested I haven't tried yet but I will try with this one: stack, example.

It woud be better if libvlc would give that, since it doesn't I have to use 3 more API's (for 3 OSs) and each of them can do what VLCJ can (only just on that platform) and I am using them just to read devices.

EDIT: Current official VLC version is 1.1.x and it has limited support for camera on Mac. You can only stream from Mac's default camera (iSight, FaceTime Built In) with no audio. VLC 1.2.0 will come out very soon an it will have much better Mac support (aware of other connected cameras, desktop stream, audio). You can see my thread on VideoLAN forum. I downloaded 1.2.0-git version of VLC for Mac and it looks so cool and has real "Mac feel". You can download it from here. But note that this is development version and it crashes a lot.

like image 57
vale4674 Avatar answered Oct 06 '22 07:10

vale4674