开发者

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

Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_运维百科

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question

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.


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.


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


Tried JMF? You can make a start here


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜