在Java中使用Mac Os X获取网络摄像头流 [英] Get webcam stream on Mac Os X in Java

查看:447
本文介绍了在Java中使用Mac Os X获取网络摄像头流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取Macbook的网络摄像头流(集成的iSight网络摄像头)。

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

我使用Java,我对Objective-一无所知C所以我正在寻找一个全java解决方案。我找到了一些类示例,但它们是在2005年制作的,它们不适用于我的系统。

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.

推荐答案

我遇到过我自己现在也是这样。我正在将VLCJ用于我的项目,它在Windows,Linux Mint,Linux Ubuntu和Mac OSX Lion上运行良好。正如你可能读到的那样,VLCJ是一个围绕libvlc的java包装器,VLC播放器也使用它。

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.

当你打开VLC播放器的捕获选项时,它会填充组合框可用的摄像头(USB连接)。但这是VLC播放器仅为自己做的事情,它不会为你提供API。如果您没有使用VLCJ将相机的ID传递给它,VLC将使用系统的默认相机。我使用VLCJ从USB连接的摄像头或桌面流式传输到文件。

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.

我必须找到一种方法在我的系统上扫描USB摄像头,这就是操作系统特定。

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

在Windows上,我使用 DirectShowJava

On windows I use DirectShowJava.

在Linux上你只需要阅读/ dev / video *以获取可用的摄像头,如果你想向用户显示一些用户友好名称您可以使用 video4linux4java

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

第3和你最感兴趣的那个我还没有尝试但是我会试着用这个:堆栈示例

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

如果libvlc给出的话会更好,因为它不需要使用3个以上的API(对于3个操作系统)而且每个都可以做什么VLCJ可以(仅在该平台上),我只是用来阅读设备。

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.

编辑:目前的官方VLC版本是1.1.x它对Mac上的相机支持有限。您只能从没有音频的Mac默认摄像头(iSight,FaceTime Built In)流式传输。
VLC 1.2.0将很快推出,它将有更好的Mac支持(了解其他连接的摄像头,桌面流,音频)。你可以看到我的主题 VideoLAN论坛。我为Mac下载了1.2.0-git版本的VLC,它看起来很酷,并且具有真正的Mac感觉。您可以从此处下载。但请注意,这是开发版本,它会崩溃很多。

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.

这篇关于在Java中使用Mac Os X获取网络摄像头流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆