FFmpeg is a powerful command-line tool for handling multimedia data. It can be used for efficient, low-resource screen recording, making it suitable for proctoring purposes where minimal system impact and reasonable file sizes are desired. This guide provides instructions for installing and using FFmpeg on Windows, macOS, and Linux using consistent parameters focused on low bitrate output.
The goal is to create screen recordings using settings like low frame rates and low bitrates, resulting in significantly compressed MP4 or MKV files appropriate for review without consuming excessive disk space or system resources during recording.
You need to have FFmpeg installed on your system. See platform-specific instructions below for installation guidance.
ffmpeg-release-essentials.zip
file. (As of early 2025, recent versions should work well).ffmpeg
. Example path: C:\Users\YourUsername\ffmpeg
.bin
subdirectory within your FFmpeg installation folder (e.g., C:\Users\YourUsername\ffmpeg\bin
) to your system's PATH environment variable. This allows running ffmpeg
from any command prompt location. If you skip this step, you must navigate to the bin
directory first before running commands.ffmpeg.exe
. Example:
cd C:\Users\YourUsername\ffmpeg\bin
<video_filename>.mp4
with your desired output file name (e.g., proctoring_session_YourName.mp4
). See the 'Command Parameters Explained' section below for details on each option.
ffmpeg -f gdigrab -r 2 -probesize 40M -threads 1 -i desktop -vcodec libx264 -b:v 256k -pix_fmt yuv420p <video_filename>.mp4
đĄ Note: If FFmpeg is in your PATH, you can run this command from any directory without the ./
prefix.
q
key..mp4
file in File Explorer.ffplay
from the command line (if available in your FFmpeg build/path):
ffplay <video_filename>.mp4
The easiest way to install FFmpeg on macOS is using Homebrew:
brew install ffmpeg
System Settings
> Privacy & Security
> Screen Recording
. You must grant this permission.ffmpeg -f avfoundation -list_devices true -i ""
Capture screen
(e.g., [AVFoundation input device @ 0x...] [1] Capture screen 0
). Note the index number in the square brackets (e.g., 1
). This is your <screen_index>
.
<screen_index>
with the number found above and <video_filename>.mp4
with your desired file name. See the 'Command Parameters Explained' section below for details on each option.
ffmpeg -f avfoundation -r 2 -probesize 40M -threads 1 -i "<screen_index>" -vcodec libx264 -b:v 256k -pix_fmt yuv420p <video_filename>.mp4
đĄ Note: This command captures video only. Capturing audio requires identifying the audio device index and modifying the -i
option (e.g., -i "<screen_index>:<audio_index>"
), which is often unnecessary for simple proctoring.
q
key..mp4
file in Finder to open it with QuickTime Player or another default media player.ffplay
in the terminal:
ffplay <video_filename>.mp4
Use your distribution's package manager.
sudo apt update && sudo apt install ffmpeg
sudo dnf install ffmpeg
sudo pacman -S ffmpeg
<video_filename>.mp4
with your desired file name. This typically works on systems using the Xorg display server. See the 'Command Parameters Explained' section below for details on each option.
ffmpeg -f x11grab -r 2 -probesize 40M -threads 1 -i :0.0 -vcodec libx264 -b:v 256k -pix_fmt yuv420p <video_filename>.mp4
đĄ Note: FFmpeg using x11grab
generally captures the entire screen connected to display :0.0
by default. If the capture area is incorrect, add the -video_size <width>x<height>
option (e.g., -video_size 1920x1080
) immediately before the -i :0.0
flag.
đĄ Wayland Users: Screen capture on Wayland typically requires different methods than x11grab
. Investigate tools compatible with your Wayland compositor (like wf-recorder
). The command above will likely not work.
q
key.ffplay
in the terminal:
ffplay <video_filename>.mp4
Here's a breakdown of the parameters used in the commands above:
-f <format>
: Specifies the input format/device driver.
gdigrab
: Used on Windows for capturing the screen.avfoundation
: Used on macOS for accessing input devices, including the screen.x11grab
: Used on Linux (with Xorg display server) for capturing the screen.-r <rate>
: Sets the output frame rate (frames per second).
2
: Used in the examples. This very low rate significantly reduces file size and CPU load, making it suitable for proctoring where smooth motion is not required, only periodic snapshots of screen activity.-probesize <size>
: Sets the initial buffer size FFmpeg uses to analyze the input stream.
40M
: Used in the examples (40 Megabytes). This can sometimes help FFmpeg start faster or avoid issues analyzing the desktop input, especially on Windows. Optional.-threads <count>
: Limits the number of CPU threads used for encoding.
1
: Used in the examples. Restricting to a single thread minimizes the performance impact on the system during recording, which is important for proctoring. Optional; removing it lets FFmpeg use more threads (potentially faster encoding but higher CPU usage).-i <input>
: Specifies the input source.
desktop
: Used with gdigrab
on Windows to select the entire desktop."<screen_index>"
: Used with avfoundation
on macOS, where <screen_index>
is the number identifying the screen capture device (found using -list_devices true
).:0.0
: Used with x11grab
on Linux, typically referring to the primary display and its entire screen area.-video_size <width>x<height>
or -s <width>x<height>
: (Optional) Explicitly sets the capture resolution. While often automatically detected (especially x11grab
), this can be added before the -i
flag if needed (e.g., -video_size 1920x1080
).-vcodec <codec>
: Specifies the video codec for encoding the output file.
libx264
: Selects the widely used H.264 codec (via the high-quality libx264
library), offering good compression.-b:v <bitrate>
: Sets the target video bitrate.
256k
: Used in the examples (256 kilobits per second). This forces a low bitrate, prioritizing small file size over high visual quality, consistent with proctoring requirements. Increase this (e.g., 512k
, 1000k
) for better quality if needed, resulting in larger files.-pix_fmt <format>
: Sets the output pixel format.
yuv420p
: A common format ensuring compatibility with most players and web browsers.<video_filename>.mp4
: The name for your output video file.
.mp4
with .mkv
if preferred. MKV (Matroska) containers can sometimes be more robust against corruption if the recording process is interrupted unexpectedly.This guide provides consistent, low-resource command examples for screen recording suitable for proctoring scenarios using FFmpeg across major desktop operating systems.