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 

    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
  • If you are not aware apropos is your friend. apropos screen capture brought up screencapture(1). man screencapture will explain how to use the utility. – fd0 May 26 '18 at 20:33
  • 1
    @fd0 thank you, i wasnt aware of apropos. it seems screencapture is used for capturing screenshots of the desktop. i didnt find any interesting commands using $ apropos camera or $ apropos webcam. any ideas? – lily May 26 '18 at 20:39


(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

$ ffmpeg -f avfoundation -list_devices true -i ""

[AVFoundation input device @ 0x7fda1bc152c0] AVFoundation video devices:
[AVFoundation input device @ 0x7fda1bc152c0] [0] FaceTime HD Camera (Built-in)
[AVFoundation input device @ 0x7fda1bc152c0] [1] Capture screen 0
[AVFoundation input device @ 0x7fda1bc152c0] AVFoundation audio devices:
[AVFoundation input device @ 0x7fda1bc152c0] [0] USB Audio CODEC
[AVFoundation input device @ 0x7fda1bc152c0] [1] Built-in Microphone

The device we're looking for is "0"

Capture the photo

$ ffmpeg -ss 0.5 -f avfoundation -i "0" -t 1 capture.jpg

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


Third party utilities like imagesnap and isightcapture would work, but I suspect you are looking for something built in?

This has been asked before in diffrent wording: How do I take a steathy picture with my iSight camera from the command line?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .