screencapture - macOS
Overview
The macOS command screencapture
is a powerful tool for capturing screenshots and screen recordings on your Mac. It provides extensive options and customization, making it suitable for various use cases.
Syntax
screencapture [options]
Options/Flags
Required:
- -i: Captures a specific window by selecting it.
Optional:
- -x: Captures the entire screen.
- -w: Captures a specific window without selecting it.
- -s: Captures a portion of the screen.
- -t [type]: Specifies the capture type:
jpg
,png
,bmp
,pdf
,tif
(default:png
). - -o [path]: Saves the capture to a specified path (default: Desktop).
- -R: Includes the mouse pointer in the capture.
- -c: Displays a camera cursor while capturing.
- -e: Saves the capture to the clipboard instead of a file.
- -d [secs]: Delays the capture by the specified number of seconds.
- -T [secs]: Sets a timer for the capture (default: 10 seconds).
- -P: Captures a screen recording.
- -F [fps]: Sets the frame rate for screen recording (default: 15).
- -a [codec]: Sets the audio codec for screen recording (
caf
oraac
default:aac
). - -v: Captures a video screen recording.
- -C: Captures a still image from a live video stream.
- -h: Displays the help message.
Examples
Capture entire screen:
screencapture -x
Capture a specific window:
screencapture -i
Capture a portion of the screen and save as PDF:
screencapture -s -t pdf -o ~/Desktop/screenshot.pdf
Capture a screen recording with audio:
screencapture -P -a aac
Capture a still image from a video stream:
screencapture -C
Common Issues
- Permission Denied: Ensure you have sufficient permissions to access the screen.
- Window Not Captured: If a window is not captured using
-i
, refresh the screen by resizing or dragging the window. - Blank Video Recording: Ensure the screen resolution is set correctly and that your Mac supports screen recording.
Integration
- Use
screencapture
withsips
to edit screenshots. - Combine
screencapture
withffmpeg
to convert screen recordings to different formats. - Utilize
Automator
to create automated workflows involvingscreencapture
.
Related Commands
Image Capture
(Graphical interface for capturing images from devices)Preview
(Editing and annotating screenshots)ffmpeg
(Advanced video conversion and editing tool)sips
(SImple Image Processing System for image manipulation)