Changelog
New

compress.target: hit a size or quality bar

Compress an image, video, or audio file to the smallest size that clears a quality bar. Named tiers or byte targets, with AVIF, JPEG XL, AV1, Opus, and more.

API Platform

compress.target is now available to every workspace. Give it a media URL and a target, and the encoder searches candidate encodes, scores each one with a perceptual metric (ssimulacra2 for images, VMAF for video), and returns the smallest file that still clears your quality bar, plus a report of what it did.

import { createClient } from "@rendobar/sdk";
const client = createClient({ apiKey: process.env.RENDOBAR_API_KEY });
const job = await client.jobs.create({
type: "compress.target",
inputs: { source: "https://example.com/photo.jpg" },
params: { target: "balanced", for: "web" },
});

What the report looks like

A real run against a 763 KB PNG, for: "web" and target: "balanced":

{
"verdict": "high",
"codec": "avif",
"metric": "ssimulacra2",
"achievedScore": 85.28,
"compressionRatio": 12.1,
"originalBytes": 781514,
"outputBytes": 64751,
"probes": 5
}
The four named tiers against one 352 KB clip. Three hand the original back rather than spend credits making it no smaller, which is what passthrough means. Only efficient finds a win.
CaseVerdictCodecVMAFSizeProbes
visually-losslesspassthroughh26496.3 343.9 KB3
balancedpassthroughh26493.3 343.9 KB5
efficientacceptableh26489.0 295.1 KB5
archivepassthroughh26496.3 343.9 KB3
Measured 2026-08-20 with the compress.target job type. VMAF is scored by the job against the original while it searches. Across all 17 cases the search ran 92 probe encodes for $0.260989.

The same call against an already-efficient 179,208 byte JPEG comes back "verdict": "passthrough" with "compressionRatio": 1 and the input bytes returned unchanged. It still ran 5 probes and scored 86.01. None of the candidates beat the original, so it handed the original back rather than spending your credits to make the file no smaller.

Targets and options

  • target takes a named tier (visually-lossless, balanced, efficient), a bare quality number from 1 to 100, or a single goal object like { maxSize: "500kb" } or { bitrate: 128 }.
  • Works on video, images, and audio. With codec: "auto" the pick respects a compatibility reach (modern, broad, legacy), or pin one of AV1, HEVC, H.264, VP9, AVIF, JPEG XL, jpegli, WebP, PNG, Opus, AAC, MP3, FLAC, or ALAC.
  • The report is honest. When no encode beats your original, you get the original back with verdict: "passthrough", because a well-optimized input is a valid answer. When a target is unreachable, the report says so instead of shipping a silent miss.
  • dryRun: true returns the predicted size and score without producing a file. maxResolution caps the longest edge. video.audioTracks, audio.loudnessLufs, and audio.channels shape the tracks. Audio bitrates are channel-aware, so a mono voice track gets a mono budget.
  • for: "web" strips metadata for delivery. for: "archive" produces a lossless master instead: PNG, FFV1, or FLAC.
  • Long videos keep the search cheap by probing short samples, and only the final encode runs over the whole file.

The reference page covers the report shape, target modes, and the codec ladder. Or try it without writing code in the dashboard playground.

The search that picks the encode got substantially faster later, see compress runs 2 to 3x faster.

Share