使用 Java 在 Mac Os X 上获取网络摄像头流

发布于 2024-09-24 00:31:01 字数 1436 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

极度宠爱 2024-10-01 00:31:01

我自己现在也遇到同样的事情。我在我的项目中使用 VLCJ,它在 Windows、Linux Mint、Linux Ubuntu 和 Mac OSX Lion 上完美运行。正如您可能读到的,VLCJ 是 libvlc 的 Java 包装器,VLC 播放器也使用它。

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

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

在 Windows 上,我使用 DirectShowJava

在 Linux 上,您只需要读取 /dev/video* 即可找到可用的摄像机,如果您想向用户显示一些“用户友好名称”,您可以使用 video4linux4java

第三个也是你最感兴趣的一个,我还没有尝试过,但我会尝试这个:堆栈示例

如果 libvlc 能够提供这一点那就更好了,因为我不必再使用 3 个 API(针对 3 个操作系统),并且每个 API 都可以做 VLCJ 可以做的事情(仅在该平台上),而且我使用它们只是为了读取设备。

编辑:当前的官方 VLC 版本是 1.1.x,它对 Mac 上的相机的支持有限。您只能从 Mac 的默认摄像头(iSight、内置 FaceTime)进行流式传输,且不带音频。
VLC 1.2.0 很快就会推出,它将有更好的 Mac 支持(了解其他连接的相机、桌面流、音频)。您可以在以下位置查看我的帖子 VideoLAN 论坛。我下载了 Mac 版 VLC 1.2.0-git 版本,它看起来很酷并且具有真正的“Mac 感觉”。您可以从此处下载它。但请注意,这是开发版本,它会崩溃很多。

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.

浮生未歇 2024-10-01 00:31:01

试过JMF吗?您可以在此处开始

Tried JMF? You can make a start here

乖乖公主 2024-10-01 00:31:01

我发现 OpenIMAJ Core Video Capture Library 在我的 MacBook、Windows PC 和 Linux 服务器上运行良好。缺点是它有很多依赖性。

所以我修改了 OpenIMAJ 代码并制作了另一个不需要那些疯狂功能的包。您可以从我的网站获取我的代码和演示应用程序(开源 bsd 许可证): http:// www.sleepingdumpling.com/blog/download/jvideoinput/

归功于 OpenIMAJ 和贡献者。

所以这也不是不可能的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文