Zero-Config Architecture

Targeted Compression

A standalone pipeline targeting strict platform upload limits. It intelligently probes, calculates optimal Bits-Per-Pixel, splits the file, and runs multithreaded hardware encoding.

Download Latest Release
$ ./20mb-hevc-win64.exe input.mp4 # Fast CLI Usage
20MB
Free Tier & Server Lvl 1

Discord Free-Tier users, DMs, Group DMs, and Server Level 1 Boosts.

50MB
Server Lvl 2 & Basic Nitro

Optimized for Discord Server Level 2 Boosts and Basic Nitro users.

100MB
Server Lvl 3 Boosts

Maximized for Discord Server Level 3 Boost upload limits.

1024MB
$10 Nitro Users

Designed for the 1 GB (1024 MB) upload limit of $10 Discord Nitro subscribers.

Drag & Drop Demonstration

The Execution Pipeline

1. Input

Drag & drop a video onto the preset executable.

2. Probe

ffprobe extracts duration, resolution, and fps.

3. Smart Split

Divides video based on 50% bit density mark to balance thread load.

4. Dual Encode

Two concurrent FFmpeg instances process chunks in parallel.

5. Stitch

Concatenates encoded chunks with +faststart for instant progressive streaming.

Reference measurements · NVIDIA GPU · 1080p60 to under 100 MB

Pipeline Dataflow Architecture

How compressed packets and raw frames move between storage, system memory, the PCIe bus and the GPU, and why keeping every frame on the GPU matters once the video has to be downscaled.

1 · At a glance

What changes when frames stay on the GPU

PCIe traffic when downscaling
64.4 GB → 0.55 GB
99.1% less data crossing the bus
Host CPU load
~30–40% → < 5%
Scaling moves from CPU cores to the GPU
Where frames live
Never leave VRAM
Decode, scale and encode all run on the GPU
Test clip used for every number on this page Reference baseline
Source
1920×1080 @ 60 fps
H.264 High, progressive
Duration
236.95 s
14,217 frames (03:56.95)
Input size
457.00 MB
16,178 kbps compressed
Target size
< 100.00 MB
3,446 kbps · 78.6% smaller
How the PCIe numbers are calculated

One raw frame in NV12 / YUV420p takes width × height × 1.5 bytes.

  • 1080p: 1920 × 1080 × 1.5 = 3,110,400 B/frame (3.11 MB) × 14,217 = 44.22 GB (186.6 MB/s per 60 fps worker)
  • 720p: 1280 × 720 × 1.5 = 1,382,400 B/frame (1.38 MB) × 14,217 = 19.65 GB (82.9 MB/s per 60 fps worker)

Native 1080p: frames never leave VRAM. Only the compressed bitstream crosses PCIe: 457 MB in + 88 MB out ≈ 545 MB.

Downscaled to 720p (legacy hybrid): FFmpeg downloads every decoded 1080p frame to system RAM for CPU Lanczos scaling (44.22 GB device → host), then uploads the 720p frames back to NVENC (19.65 GB host → device). With the bitstream that is ≈ 64.41 GB of PCIe traffic.

2 · Mode explorer

Pick a pipeline, see which hardware does the work

Each mode highlights the hardware it uses and shows how much data crosses the PCIe bus for the test clip.

Storage NVMe / disk
Input bitstream
457.00 MB
input.mp4 (H.264)
Muxed output
< 100.00 MB
output.mp4 (+faststart)
System memory & CPU DDR4 / DDR5
Demux buffers
O(1) streaming
< 15 MB RAM footprint
CPU Lanczos Scale
Bypassed (Native)
libswscale filtergraph
PCIe 4.0 x16 bus Minimal (~2 MB/s)
Host → GPU (H2D)
~457 MB (Stream)
Inbound to VRAM
GPU → host (D2H)
~88.5 MB (Muxed)
Outbound to host
GPU silicon & VRAM Hardware ASICs
NVDEC
Hardware decode
Direct VRAM surface
NVENC
Hardware encode
VBR multipass fullres
Live readout Direct Hardware Path
Total PCIe volume
~545 MB Total
99.1% Bus Reduction
Frame pixel format
pix_fmt: cuda
VRAM Surface
Scaling location
Bypassed
Zero Pixel Copies
Host CPU load
< 5% Load
Demux / Telemetry

Hardware Native Unscaled (1080p60)

Zero-copy VRAM execution with zero software scaling copies.

Frames are demuxed from storage and streamed as compressed NAL packets across PCIe into GPU VRAM. NVDEC decodes into CUDA surfaces, the frame scaling filter is completely bypassed (zero software pixel copies), and NVENC encodes directly on-chip. Only compressed bitstream traverses PCIe.

Why it matters: When the BPP calculator decides to downscale (for example 1080p to 720p), running the scaler on the CPU forces a ~64 GB PCIe roundtrip. The zero-copy pipeline resizes frames in video memory with each vendor's native scaler instead: scale_cuda on NVIDIA, scale_vaapi on VA-API, vpp_amf on AMD, vpp_qsv on Intel and scale_vt on macOS. The NVIDIA case measured here gets back to native 545 MB PCIe traffic without losing quality. If an input cannot be decoded in hardware, the pipeline falls back to an upload tier, then to the legacy path.

3 · Pipeline diagrams

How the pipeline evolved: three physical paths

With native 1080p, frames stay in VRAM. Once the video is downscaled, where the scaler runs decides how much raw video crosses the PCIe bus. Pick a path, or compare the legacy and current ones side by side.

Path 3 · Current implementation (CUDA example)

Zero-copy: decode, scale and encode in VRAM

Decoded surfaces stay in GPU memory and scale_cuda resizes them on-chip, so only compressed data ever crosses PCIe.

PCIe: 545.5 MB · 99.1% less
Path 3 Zero-Copy scale_cuda Pipeline Flowchart
System RAMO(1) streaming
  • Demux stream inbound 457.00 MB bitstream Streamed directly across PCIe
  • Mux stream outbound 88.50 MB encoded stream Piped straight into the final MP4
  • Software frame copies 0.00 GB (zero copies) No pixel buffers allocated

Host footprint: < 15 MB RAM · < 3% CPU

PCIe 4.0 x16 busCompressed data only
  • 1 · H2D inbound457.00 MB
    Compressed bitstream only (~1.9 MB/s)
  • 2 · D2H outbound88.50 MB
    Compressed bitstream only (~0.37 MB/s)
  • PCIe bandwidth saved 63.86 GB eliminated 99.1% of PCIe traffic removed

Total PCIe volume: 545.5 MB

GPU silicon & VRAM100% VRAM resident
  • NVDEC decoder Direct to CUDA surface pix_fmt cuda surface in GDDR
  • scale_cuda (CUDA cores) On-chip Lanczos resize 1080p → 720p without leaving VRAM
  • NVENC encoder Direct VRAM consumption No pixel transfer latency

Estimated ~15–18 s encode

Current implementation: -hwaccel cuda -hwaccel_output_format cuda combined with -vf scale_cuda=-2:720:interp_algo=lanczos keeps decoded surfaces entirely in VRAM. Downscaling then costs no more PCIe traffic than a native 1080p encode.

4 · Benchmarks

Every version side by side

Same test clip: 1080p60, 236.95 s, 14,217 frames, 457.00 MB, NVIDIA GPU. Values marked est. are estimates, not measurements.

Metric v1.1.52 passes, downscaled v1.1.6-prePath 1 · CPU decode v1.1.6Path 2 · legacy hybrid CurrentPath 3 · zero-copy
Passes executed 2 (fake pass 1) 1 1 1
Video decode GPU NVDEC (×2) CPU software (avcodec) GPU NVDEC (×1) GPU NVDEC (×1)
Scaling CPU software (×2) CPU software CPU software (lanczos) GPU CUDA cores (scale_cuda)
PCIe bus volume ~128 GB (2 roundtrips) ~19.74 GB (H2D scaled) ~64.41 GB (1 roundtrip) 0.55 GB (−99.1%)
System RAM I/O > 200 GB > 60 GB ~64 GB < 1 GB
CPU utilization 43% 91% (NVENC starved) ~30–40% < 5%
GPU decode engine ~88% 0% (idle) ~88% ~88%
GPU 3D / CUDA engine ~91% ~4% ~5–10% ~35–50% (scale_cuda)
Wall-clock encode 37.81 s 23.22 s (CPU-bound) 22.4–23.0 s ~15–18 s (est.)

Takeaway: The single-pass legacy hybrid (Path 2) halved PCIe traffic compared with v1.1.5 and cut wall-clock time from 37.8 s to 22.4 s by dropping the first pass and decoding on NVDEC. The zero-copy pipeline (Path 3) then removes a further 99.1% of PCIe traffic, down to 545 MB, and frees the host CPU and RAM almost entirely.

5 · Split & stitch

How one video becomes two parallel encodes

Hardware encodes run as two workers at once. The split point is found by reading packet headers only, so no video is decoded to choose it.

  1. Step 1 · Probe

    Read packet headers

    ffprobe -select_streams v:0
      -show_entries packet=pts_time,size,flags
      -of csv=p=0

    A line-by-line reader adds up packet sizes and notes keyframe timestamps (flags=K). No frames are decoded and memory stays under 10 MB.

  2. Step 2 · Balance

    Split at 50% of the bytes

    The split point T is the keyframe closest to half of the total byte weight, so both workers get an equal amount of data. Cutting on a keyframe means each half can be decoded on its own.

  3. Step 3 · Encode

    Two workers in parallel

    Worker 1 encodes 0 → T, worker 2 encodes T → end, each as its own FFmpeg process with a bitrate for its half. Worker 2 resets its timestamps to zero with -avoid_negative_ts make_zero.

  4. Step 4 · Stitch

    Join without re-encoding

    ffmpeg -f concat -safe 0 -i list.txt
      -c copy -movflags +faststart

    The concat demuxer joins both halves in under a second and moves the index (moov box) to the front of the file so it can start playing before it fully downloads.

Known issue: the stitch currently leaves a 40–100 ms gap in video timestamps at T. Playback stutters briefly there and video runs slightly behind audio for the second half. A fix is planned for the next release; see Known Issues.

Show the full split flowchart
Smart Split 3-Phase Workload Partitioning Flowchart

Parallel Processing Engine

By dividing the video at a calculated keyframe and utilizing Python's threading to run multiple FFmpeg subprocesses simultaneously, the tool significantly reduces encoding times on modern multi-core systems and hardware encoders.

Progress Aggregation

A thread-safe ProgressTracker class parses stderr from both FFmpeg instances, merging ETA and speed metrics into a unified console output.

Parallel Split Encoding

Hardware encoders execute a dual-worker parallel split pipeline with on-chip rate control and hardware lookahead for maximum speed and bitrate compliance.

Safe Concatenation

Chunks are stitched using FFmpeg's concat demuxer with +faststart, relocating the moov atom to the front for progressive streaming without re-encoding.

Parallel vs Serial Efficiency

Abstract relative duration showing multithreaded efficiency.

BPP Scaling Logic Simulator

To prevent extreme pixelation, the script ensures the target bitrate yields a Bits-Per-Pixel (BPP) ≥ 0.04. If it fails, the script automatically tests lower resolutions and framerates. Use this calculator to see how the script decides whether to scale down a video based on your inputs.

Source Video Profile

Logic Candidates

Threshold: BPP >= 0.04
Resolution FPS Calculated BPP Status

Hardware Priority Matrix

The tool uses a dynamic fallback chain. It tests hardware availability with a dummy encode and selects the fastest valid encoder before falling back to CPU-based rendering. Select an OS to view its priority mapping.

Windows Priority