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

4

7

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.

Plumbago answered 20/9, 2010 at 10:34 Comment(0)
R
6

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.

Richelle answered 8/12, 2011 at 10:23 Comment(1)
@Matthieu I just edited my answer with some Mac OS X specifics, hopefully it will spare you some time :)Richelle
E
1

Have a look at QuickTime for Java or Java Bindings for VideoLAN.

Efferent answered 20/9, 2010 at 11:43 Comment(3)
I read "The new version also neglected to provide a component to show a visual preview of the input from a capture device, such as a webcam or camcorder" for Quicktime. It seems that Java is not really a concern for Apple... See also here : onjava.com/pub/a/onjava/2003/10/29/qtj-returns.html?page=last (in "Other changes"). As for VideoLAN, it seems it is not able to capture from a webcam.Plumbago
Yes, I didn't know QTJava had been deprecated, sorry: lists.apple.com/archives/quicktime-java/2008/Jun/msg00018.htmlEfferent
VLC should be able to capture from a webcam...file -> open capture deviceTrudi
R
0

Tried JMF? You can make a start here

Ragged answered 20/9, 2010 at 10:44 Comment(1)
It seems to be for Windows or Solaris for the webcam. No mention of OS X or MacPlumbago
S
0

I found OpenIMAJ Core Video Capture Library which works well on my MacBook, Windows PC and Linux server. The downside is that it has a lot of dependencies.

So I modified OpenIMAJ code and made another package that doensn't need those crazy features. You can get my code and demo application (open source bsd license) from my site: http://www.sleepingdumpling.com/blog/download/jvideoinput/

credit goes to OpenIMAJ and contributors.

So it is not impossible.

Selmore answered 6/3, 2013 at 14:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.