Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dbalabka/58ef3cebf42bd870f7e3d88e500476ab to your computer and use it in GitHub Desktop.

Select an option

Save dbalabka/58ef3cebf42bd870f7e3d88e500476ab to your computer and use it in GitHub Desktop.
Record and Compress Screen Videos on Windows

Record and Compress Screen Videos on Windows

This guide explains how to record your screen using built-in Windows tools and compress large recordings with FFmpeg.

1. Record the screen

Option A: Xbox Game Bar

Xbox Game Bar is convenient for recording an application or game window.

  1. Open the application you want to record.
  2. Press Win + G to open Xbox Game Bar.
  3. In the Capture panel, click Start recording.

Useful shortcuts:

  • Win + Alt + R — start or stop recording
  • Win + Alt + M — enable or disable the microphone
  • Win + G — open Xbox Game Bar

Recordings are normally saved as MP4 files in:

C:\Users\<username>\Videos\Captures

Official documentation:

Option B: Snipping Tool

Snipping Tool is useful when you need to record a specific region of the screen.

  1. Press Win + Shift + R.
  2. Select the area you want to record.
  3. Click Start.
  4. When finished, click Stop and save the video.

On supported Windows 11 versions, recordings are automatically saved in:

C:\Users\<username>\Videos\Screen Recordings

Official documentation:

2. Install FFmpeg

Open PowerShell or Windows Terminal and run:

winget install --id Gyan.FFmpeg.Shared -e

After installation, close and reopen PowerShell. Verify that FFmpeg is available:

ffmpeg -version

Official documentation:

3. Compress the recording

Open PowerShell in the folder containing the video.

A quick way to do this is to open the folder in File Explorer, click the address bar, type powershell, and press Enter.

Run:

ffmpeg -i ".\input video.mp4" -c:v libx264 -crf 28 -preset slow -pix_fmt yuv420p -c:a aac -b:a 96k -movflags +faststart ".\compressed video.mp4"

Replace:

  • input video.mp4 with the original filename
  • compressed video.mp4 with the desired output filename

Quotation marks are required when filenames contain spaces.

Compression settings

The -crf value controls the balance between quality and file size:

  • 23 — higher quality and a larger file
  • 26–28 — good balance for most screen recordings
  • 29–32 — smaller file with more visible quality loss

Lower CRF values produce higher quality and larger files. Higher values produce smaller files.

For example, use CRF 30 for stronger compression:

ffmpeg -i ".\input video.mp4" -c:v libx264 -crf 30 -preset slow -pix_fmt yuv420p -c:a aac -b:a 96k -movflags +faststart ".\compressed video.mp4"

4. Optional: reduce resolution and frame rate

For tutorials, bug reports, and mostly static screen content, reducing the frame rate to 30 FPS and limiting the width to 1920 pixels can save additional space:

ffmpeg -i ".\input video.mp4" -vf "fps=30,scale='min(1920,iw)':-2" -c:v libx264 -crf 28 -preset slow -pix_fmt yuv420p -c:a aac -b:a 96k -movflags +faststart ".\compressed video.mp4"

Important notes

Compressing a recording from several gigabytes to only a few dozen megabytes is sometimes possible for short recordings with mostly static content. The final size depends on:

  • Video duration
  • Resolution
  • Frame rate
  • Amount of movement
  • Selected CRF value
  • Audio bitrate

Keep the original recording until you have checked that the compressed version is readable and contains the expected audio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment