Skip to content

Instantly share code, notes, and snippets.

@stevecooperorg
Created August 24, 2025 08:57
Show Gist options
  • Select an option

  • Save stevecooperorg/dd1171f11c742522c5634ab25b4731d8 to your computer and use it in GitHub Desktop.

Select an option

Save stevecooperorg/dd1171f11c742522c5634ab25b4731d8 to your computer and use it in GitHub Desktop.
video prep for youtube

FFmpeg Installation and Video Conversion Tutorial for Windows

Overview

This tutorial will guide you through manually installing FFmpeg on Windows and using it to convert large video files (like 12GB files) into smaller, YouTube-compatible formats. You'll learn how to control the output resolution and quality to meet your specific needs.

Prerequisites

  • Windows 10 or later
  • Administrator access to your computer
  • A large video file you want to convert

Part 1: Understanding Command Prompt

What is Command Prompt?

Command Prompt (also called "cmd" or "Command Line") is a text-based interface in Windows that allows you to run programs and commands by typing text instead of clicking buttons. Think of it as a way to "talk" directly to your computer using typed commands.

Why We Need Command Prompt

FFmpeg is a command-line tool, which means it doesn't have a graphical interface with buttons and menus. Instead, you type commands to tell it what to do. Don't worry - we'll provide you with exact commands to copy and paste!

How to Open Command Prompt

  1. Method 1 (Recommended): Press Win + R, type cmd, press Enter
  2. Method 2: Right-click the Start button, select "Command Prompt" or "Windows Terminal"
  3. Method 3: Type "cmd" in the Windows search bar, click "Command Prompt"

Command Prompt Basics

  • Current Directory: Shows where you are in your computer's file system (e.g., C:\Users\YourName>)
  • Commands: Type text and press Enter to execute
  • File Paths: Use backslashes \ to navigate folders (e.g., C:\Videos\)
  • Quotes: Use quotes around filenames with spaces (e.g., "My Video.mp4")
  • Copy/Paste: Right-click to paste, or use Ctrl + V

Important: Run as Administrator

Some commands require administrator privileges. To do this:

  1. Press Win + X
  2. Select "Windows Terminal (Admin)" or "Command Prompt (Admin)"
  3. Click "Yes" when prompted

Part 2: Installing FFmpeg

Manual Installation (Recommended)

  1. Download FFmpeg

    • Go to https://ffmpeg.org/download.html
    • Click "Windows Builds" under "Get packages & executable files"
    • Click "Windows builds from gyan.dev" (recommended)
    • Download the "essentials" build (e.g., "ffmpeg-6.1-essentials_build.zip")
  2. Extract and Install

    • Extract the ZIP file to C:\ffmpeg
    • Copy the contents of the bin folder to C:\ffmpeg\bin
    • Add to PATH:
      • Press Win+R, type sysdm.cpl, press Enter
      • Click "Environment Variables"
      • Under "System Variables", find "Path" and click "Edit"
      • Click "New" and add C:\ffmpeg\bin
      • Click OK on all dialogs
  3. Verify Installation

    • Open Command Prompt and type: ffmpeg -version

Part 3: Converting Large Video Files

Basic Command Structure

ffmpeg -i "input_video.mp4" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k "output_video.mp4"

Understanding the Parameters

  • -i "input_video.mp4": Your source video file
  • -c:v libx264: Use H.264 video codec (YouTube compatible)
  • -crf 23: Quality setting (18-28 range, lower = better quality, larger file)
  • -preset medium: Encoding speed (slower = better compression, faster = larger file)
  • -c:a aac: Audio codec
  • -b:a 128k: Audio bitrate

Part 4: Resolution Control Examples

Example 1: Convert to 1080p (Full HD)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 23 -preset medium -vf "scale=1920:1080" -c:a aac -b:a 128k "output_1080p.mp4"

Example 2: Convert to 720p (HD)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 23 -preset medium -vf "scale=1280:720" -c:a aac -b:a 128k "output_720p.mp4"

Example 3: Convert to 480p (SD)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 23 -preset medium -vf "scale=854:480" -c:a aac -b:a 128k "output_480p.mp4"

Example 4: Convert to 4K (Ultra HD)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 18 -preset slow -vf "scale=3840:2160" -c:a aac -b:a 192k "output_4k.mp4"

Example 5: Maintain Aspect Ratio (Auto-scale)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 23 -preset medium -vf "scale=1280:720:force_original_aspect_ratio=decrease" -c:a aac -b:a 128k "output_720p_auto.mp4"

Part 5: Quality and File Size Control

CRF Values for Different Quality Levels

  • CRF 18: Visually lossless, very large files
  • CRF 20: High quality, large files
  • CRF 23: Good quality, balanced (recommended for most uses)
  • CRF 26: Acceptable quality, smaller files
  • CRF 28: Lower quality, much smaller files

Preset Options for Encoding Speed

  • ultrafast: Fastest encoding, largest files
  • superfast: Very fast, large files
  • veryfast: Fast, large files
  • faster: Fast, large files
  • fast: Fast, large files
  • medium: Balanced (recommended)
  • slow: Slower, smaller files
  • slower: Slower, smaller files
  • veryslow: Slowest, smallest files

Part 6: Practical Examples for Different Use Cases

For YouTube Uploads (Recommended Settings)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 23 -preset medium -vf "scale=1920:1080" -c:a aac -b:a 128k -movflags +faststart "youtube_ready.mp4"

For Web Sharing (Smaller Files)

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 26 -preset fast -vf "scale=1280:720" -c:a aac -b:a 96k "web_ready.mp4"

For Mobile Devices

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 25 -preset fast -vf "scale=854:480" -c:a aac -b:a 64k "mobile_ready.mp4"

For High-Quality Archiving

ffmpeg -i "large_video.mp4" -c:v libx264 -crf 18 -preset slow -vf "scale=1920:1080" -c:a aac -b:a 192k "archive_quality.mp4"

Part 7: Step-by-Step Conversion Process

  1. Prepare Your Files

    • Place your large video file in a folder (e.g., C:\Videos\)
    • Open Command Prompt in that folder (Shift + Right-click → "Open command window here")
  2. Choose Your Resolution and Quality

    • Decide on target resolution based on your needs
    • Choose appropriate CRF value and preset
  3. Run the Conversion

    • Copy the appropriate command from above
    • Replace "large_video.mp4" with your actual filename
    • Replace "output_video.mp4" with your desired output filename
    • Press Enter and wait for completion
  4. Monitor Progress

    • FFmpeg will show progress information
    • Conversion time depends on file size and your computer's speed

Part 8: Troubleshooting Common Issues

"ffmpeg is not recognized"

  • Restart Command Prompt after installation
  • Verify PATH environment variable is set correctly
  • Try using the full path: C:\ffmpeg\bin\ffmpeg.exe

"Permission denied"

  • Run Command Prompt as Administrator
  • Check if antivirus is blocking FFmpeg

"File not found"

  • Ensure you're in the correct directory
  • Check file path and spelling
  • Use quotes around filenames with spaces

"Conversion takes too long"

  • Use faster presets (e.g., -preset fast instead of -preset medium)
  • Increase CRF value (e.g., -crf 26 instead of -crf 23)
  • Lower target resolution

Part 9: Estimating File Sizes

Rough Size Estimates (for 1 hour of video)

  • 4K (3840x2160): 8-15 GB
  • 1080p (1920x1080): 2-4 GB
  • 720p (1280x720): 1-2 GB
  • 480p (854x480): 500 MB - 1 GB

Factors Affecting File Size

  • Resolution (higher = larger)
  • CRF value (lower = larger)
  • Preset (slower = smaller)
  • Video content (complex scenes = larger)
  • Audio quality (higher bitrate = larger)

Part 10: Advanced Tips

Batch Conversion (Multiple Files)

for %i in (*.mp4) do ffmpeg -i "%i" -c:v libx264 -crf 23 -preset medium -vf "scale=1280:720" -c:a aac -b:a 128k "converted_%i"

Two-Pass Encoding (Better Quality)

ffmpeg -i "input.mp4" -c:v libx264 -preset medium -b:v 2M -pass 1 -an -f null NUL
ffmpeg -i "input.mp4" -c:v libx264 -preset medium -b:v 2M -pass 2 -c:a aac -b:a 128k "output.mp4"

Extract Audio Only

ffmpeg -i "video.mp4" -vn -c:a aac -b:a 128k "audio.m4a"

Conclusion

With FFmpeg installed and these examples, you can now convert large video files to any resolution and quality level you need. Start with the recommended settings (CRF 23, medium preset) and adjust based on your file size and quality requirements. Remember that higher quality means larger files, so find the right balance for your specific use case.

For YouTube uploads, 1080p with CRF 23 typically provides excellent quality while keeping file sizes manageable. If you need smaller files, try 720p resolution or increase the CRF value to 26.

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