camera调试命令_通过命令行访问Mac Camera

camera调试命令

FaceTime HD Camera

With all of my recent command line tutorials, I've really gotten excited about the shell's simplicity and realized the true power of using the underlying technology of pretty UIs.  Since I work from home, I spend a lot of time on video calls, so when I started playing around with command line utilities like ImageMagick and ffmpeg, I instantly asked myself:  how can I take a photo with the Mac's camera from within the terminal?

在最近的所有命令行教程中 ,我真的对Shell的简单性感到兴奋,并意识到了使用漂亮UI的底层技术的真正力量。 由于我在家工作,因此我在视频通话上花费了大量时间,因此当我开始使用ImageMagick和ffmpeg等命令行实用程序玩耍时,我立即问自己:如何在终端中使用Mac的相机拍照?

It turns outs out OS X doesn't provide that access; a third party utility named ImageSnap is the best route to taking captures from command line.

事实证明,OS X不提供该访问权限。 名为ImageSnap的第三方实用程序是从命令行进行捕获的最佳途径。

安装ImageSnap (Install ImageSnap)

I like using Homebrew to manage installs:

我喜欢使用Homebrew来管理安装:


brew install imagesnap


You can compile from source if you like, obviously.

显然,您可以根据需要从源代码进行编译。

拍张照片 (Take a Photo)

To take a photo using the default video input device (FaceTime HD Camera is the default in most newer Macs), simply execute this:

要使用默认的视频输入设备( FaceTime HD相机是大多数较新的Macs的默认设置)拍摄照片,只需执行以下步骤:


# Take image, let camera warm up 1 second
imagesnap -w 1 snapshot.png


You'll wait a brief second or two, your green camera indicator will light up, and will then quickly fade out.  The image will be saved to a snapshot.png file.

您将等待一两秒钟,绿色的相机指示灯将点亮,然后快速消失。 图像将保存到snapshot.png文件中。

ImageSnap also has the functionality to take a photo every n seconds:

ImageSnap还具有每n秒拍摄一张照片的功能:


# imagesnap -t {x}:{yy} seconds
imagesnap -t 1 -w 1


The command above takes a photo every second until the process is killed.

上面的命令每秒钟拍摄一张照片,直到进程被杀死。

While I looked for this ability out of curiosity, there are some great use cases for taking images from command line, like tracking your Mac if it's stolen or taking a photo upon invalid login.  Imagesnap is an incredible utility:  simple to use and doesn't try to accomplish too much!

当我出于好奇而寻找这种功能时,有一些很好的用例是从命令行拍摄图像,例如跟踪Mac是否被盗或在无效登录后拍照。 Imagesnap是一个令人难以置信的实用程序:易于使用并且不会尝试完成太多任务!

翻译自: https://davidwalsh.name/mac-camera

camera调试命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值