macos Mac 网络摄像头 - 获取设备
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6557655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mac webcam - get the device
提问by michael
How do I access my default video camera on my mac? I know on Linux it is /dev/video0 but my Mac does not have that. I'm trying to capture my webcam into ffmpeg
如何访问我的 Mac 上的默认摄像机?我知道在 Linux 上它是 /dev/video0 但我的 Mac 没有。我正在尝试将我的网络摄像头捕获到 ffmpeg 中
ffmpeg -i /dev/video0
But it won't work because /dev/video0 doesn't exist.
但它不起作用,因为 /dev/video0 不存在。
回答by Mike F
You can achieve this by using VLC's qtcapture (QTKit
) or avcapture (AVFoundation
) module introduced with VLC 2.0.0 and
您可以通过使用VLC 2.0.0 中引入的VLC 的 qtcapture ( QTKit
) 或 avcapture ( AVFoundation
) 模块来实现这一点,
Try this via command line - Note: you still need to hit play i guess:
通过命令行试试这个 - 注意:我猜你仍然需要点击播放:
QTCapture (using the QTKit
Framework)
QTCapture(使用QTKit
框架)
VLC.app/Contents/MacOS/VLC -vvv qtcapture://
AVCapture (using the AVFoundation
Framework)
AVCapture(使用AVFoundation
框架)
VLC.app/Contents/MacOS/VLC -vvv avcapture://
You can also control this via GUI: VLC -> File -> Open Capture Device...
您也可以通过 GUI 进行控制:VLC -> 文件 -> 打开捕获设备...
Also if you really want to have control over things you can look into AVFoundation
Framework or the older QTKit
Framework to access your camera (video/audio devices) programmatically.
此外,如果您真的想控制事物,您可以查看AVFoundation
框架或旧QTKit
框架以编程方式访问您的相机(视频/音频设备)。
If you have trouble finding devices try to debug it by finding out if the device is actually recognized by VLC. The verbose output through the terminal or the Log View in GUI mode should show you which devices are actually available:
如果您在查找设备时遇到问题,请尝试通过查明设备是否被 VLC 实际识别来调试它。通过终端或 GUI 模式下的日志视图的详细输出应显示哪些设备实际可用:
回答by ddaaggeett
here's the documentationfor macos
这是macos的文档
here'san example using linux, but it can be done with the above link just as easily with macos.
这是一个使用 linux 的示例,但可以使用上面的链接轻松完成,就像使用 macos 一样。
回答by mcv
My impression is that it's hard to impossible. Apple locked it down quite a bit. There's the nearly unfindable iSightCapturewhich apparently only works when run directly on the command line (used to work fine in scripts before 10.4, but Apple blocked that), and I think it only takes images, not video.
我的印象是很难甚至不可能。苹果将其锁定了很多。有一个几乎找不到的iSightCapture,它显然只在直接在命令行上运行时才有效(过去在 10.4 之前的脚本中可以正常工作,但 Apple 阻止了它),而且我认为它只拍摄图像,而不是视频。
Considering someone wrote that, it should be possible to access it programmatically, but iSightCapture is not open source, and I haven't been able to find how to do it myself. Though I admit I gave up pretty quickly once I realized it's clearly not a standard webcam.
考虑到有人写过,应该可以通过编程方式访问它,但是 iSightCapture 不是开源的,我自己也找不到如何去做。虽然我承认一旦我意识到它显然不是标准的网络摄像头,我很快就放弃了。