←Back to Guides
๐ŸŽฌVideo & Compression Engineeringโฑ๏ธ 19 min read•Updated November 2026

Video Codecs, Bitrate Allocation & Streaming Compression Runbook

Comprehensive engineering guide to modern video compression codecs (H.264 AVC, H.265 HEVC, VP9, AV1), rate control modes (CRF, VBR, CBR), audio encoding overhead, and optimal upload bitrate formulas for streaming platforms and social media.

#Video#Compression#H.264#HEVC#AV1#Bitrate#FFmpeg

1. Codec Generations: AVC, HEVC, VP9 & AV1 Compared

Digital video delivery balances three competing dimensions: compression efficiency (visual quality per megabyte), decoding hardware ubiquity (battery life and device compatibility), and licensing/royalty constraints. While legacy H.264 (AVC) remains supported on 99.9% of all digital screens, modern open standards like AV1 achieve identical structural similarity (SSIM) and VMAF scores at half the data footprint. Understanding codec characteristics determines whether your video streams smoothly or stutters over congested mobile networks.
FFmpeg Codec Inspection & Stream Analysis
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,profile,width,height,bit_rate,r_frame_rate -of json input.mp4

Extracts video codec name, compression profile, dimensions, target bitrate, and framerate in structured JSON.

Codec / StandardEfficiency vs H.264Primary Adoption & Platform SupportHardware Decoding SupportCopy
H.264 / AVC (x264)Baseline (0% reduction). Highest compatibility across all legacy browsers, game consoles, and smart TVs.Universal Legacy Standard100% universal hardware support across all modern CPU/GPUs.
H.265 / HEVC (x265)~40-45% bitrate reduction vs H.264 at equivalent visual quality. Royalty-encumbered.Apple iOS / 4K BroadcastNative Apple Silicon, Intel Gen 7+, NVIDIA GTX 960+. Limited browser support on Chrome/Firefox.
VP9 (libvpx-vp9)~35-40% bitrate reduction vs H.264. Open-source Google standard used across YouTube 1440p/4K.Web & YouTube IngestionUniversal support across modern Chromium browsers, Android, and Apple Safari (macOS/iOS 14+).
AV1 (libsvtav1)~50-55% bitrate reduction vs H.264, ~20-25% vs HEVC. Royalty-free Alliance for Open Media standard.Next-Gen Streaming StandardNVIDIA RTX 30/40, AMD RDNA2+, Apple M3+, Intel Arc, Android 14+ flagships.

2. Rate Control Modes: CRF vs 2-Pass VBR vs CBR

Choosing a rate control mode informs the video encoder how to allocate bits across spatial complexity (high-detail foliage vs flat skies) and temporal movement (fast action vs talking heads). Constant Rate Factor (CRF) is the gold standard for archival and single-file master encodes, dynamically raising bitrate during high-motion bursts while conserving bytes during static scenes. In contrast, Constant Bitrate (CBR) is strictly required for real-time live streaming (RTMP/WebRTC) to prevent exceeding client bandwidth thresholds.
Master CRF Video Encoding (SVT-AV1)
ffmpeg -i master_input.mov -c:v libsvtav1 -preset 5 -crf 26 -g 120 -c:a libopus -b:a 128k -movflags +faststart output_av1.mp4

Encodes visually lossless AV1 video with keyframe intervals tuned for web seeking (g=120) and Opus audio.

Two-Pass Target Size H.264 Encoding
# Pass 1 (Generate statistics log)
ffmpeg -y -i input.mp4 -c:v libx264 -b:v 4500k -pass 1 -an -f null /dev/null
# Pass 2 (Execute optimal allocation)
ffmpeg -i input.mp4 -c:v libx264 -b:v 4500k -pass 2 -c:a aac -b:a 192k -movflags +faststart output.mp4

Precisely controls maximum output file size to satisfy strict email, Discord, or platform upload limits.

3. Video Bitrate Allocation & File Size Mathematics

Video file size is governed by a strict deterministic equation: total file size equals aggregate bitrate (video stream plus audio stream plus container overhead) multiplied by duration in seconds. Audio bitrate overhead is frequently underestimated: a 320 kbps uncompressed AAC audio track on a 60-minute video accounts for 144 Megabytes of the total payload alone. Factoring in container multiplexing overhead (~1.5% for MP4/MKV) prevents unexpected upload rejections on strict file gates.
Target Resolution & FrameratePlatform Recommended Bitrate (H.264)Recommended Bitrate (AV1 / HEVC)File Size (10-Minute Video)Copy
4K UHD (2160p, 60fps)45,000 - 68,000 kbps (YouTube recommended)25,000 - 35,000 kbps~3.4 GB (H.264) / ~1.9 GB (AV1)
1440p QHD (60fps)24,000 - 30,000 kbps14,000 - 18,000 kbps~1.8 GB (H.264) / ~1.1 GB (AV1)
1080p FHD (60fps High-Motion)12,000 - 15,000 kbps (Twitch/YouTube)6,000 - 8,000 kbps~900 MB (H.264) / ~480 MB (AV1)
1080p FHD (30fps Standard)8,000 - 10,000 kbps (TikTok / Reels)4,000 - 5,500 kbps~600 MB (H.264) / ~320 MB (AV1)
720p HD (30fps Web/LMS)3,000 - 5,000 kbps1,500 - 2,500 kbps~250 MB (H.264) / ~130 MB (AV1)

4. Production FFmpeg Compression Recipes

Standard production pipelines rely on scripted CLI recipes to standardize video ingestion, normalize audio loudness to -14 LUFS (the universal streaming loudness target), and position MP4 metadata for progressive streaming. Shifting the moov atom to the beginning of the file via -movflags +faststart ensures browsers begin playback after downloading the first 64 KB rather than requiring full file buffering.
Broadcast Loudness Normalization (-14 LUFS) & Web MP4
ffmpeg -i input.mov -c:v libx264 -preset slow -crf 20 -filter:a loudnorm=I=-14:LRA=7:tp=-1.5 -c:a aac -b:a 192k -movflags +faststart web_ready.mp4

Normalizes dynamic audio range to ITU-R BS.1770 / EBU R128 standards for YouTube and podcast publishing.

Lossless Keyframe-Accurate Stream Trimming
ffmpeg -ss 00:01:30 -to 00:04:15 -i source.mp4 -c copy -avoid_negative_ts make_zero trimmed_clip.mp4

Cuts video losslessly without generational re-encoding by copying existing stream packets between I-frames.

๐ŸŽ“Explore More Guides

โœจ