Is it possible to take a photo or record a short video with the MacBook's webcam using Terminal?
sh-3.2# system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 10.13.4 (17E199)
Kernel Version: Darwin 17.5.0
Boot Volume: lily
Boot Mode: Normal
Computer Name: lily’s MacBook Air
User Name: System Administrator (root)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Best Answer
Use FFMPEG.
(This has become one of my favorite command line utilities for video/audio conversion and streaming)
According to the FFMPEG Wiki, you can use Apple's AVFoundation to capture directly from the FaceTime Camera or any other USB web cam that's attached. Keep in mind, the wiki was written when the FaceTime camera was still called the iSight so some of the features/keywords are no longer valid
Get the device ID
The device we're looking for is "0"
Capture the photo
What this does is take a 1 second video stream, takes the single fram starting at .5 seconds and saves it as a JPEG called
capture.jpg