Optimizing Presets in THandBrake (formerly Smallx264) for Streaming and ArchivalTHandBrake (formerly Smallx264) is a powerful preset and profile manager built around x264/HandBrake workflows. Whether you’re creating streams for live-like delivery to platforms (OBS, Twitch, YouTube Live) or archiving large libraries for long-term storage, choosing and tuning the right preset is crucial to balance visual quality, file size, encoding time, and playback compatibility. This article walks through the key concepts, recommended presets and settings for streaming vs archival use cases, testing methodology, and practical tips for building reproducible encoding workflows.
Key concepts and goals
- Purpose difference:
- Streaming: low latency, constant or limited bitrate (CBR or capped VBR), small encoding latency, and predictable output for network delivery and player compatibility.
- Archival: maximum visual quality per bit (compression efficiency), long-term compatibility, metadata for search and restore, and storage cost control.
- Quality metrics:
- Objective: bitrate, PSNR/SSIM/VMAF (VMAF is most aligned with perceived quality).
- Subjective: visual inspection on intended display sizes and content types (animation vs live action).
- Encoding tradeoffs:
- Speed vs quality: slower presets generally yield better compression (smaller file for same perceived quality) but require more CPU time.
- Latency vs complexity: low-latency streaming often requires simpler motion estimation and shorter lookahead.
- Compatibility:
- Container (MP4/MKV/MOV) and codec compatibility matters for platform ingestion and player support.
- Color space, chroma subsampling, and audio codecs also affect compatibility.
How THandBrake presets map to use cases
THandBrake presets wrap x264/HandBrake parameters (preset, tune, CRF/bitrate, profile/level, B-frames, reference frames, etc.). Generally:
- “Veryfast”/“Faster”/“Fast” — suited for streaming (lower CPU, lower latency).
- “Medium”/“Slow”/“Slower”/“Placebo” — targeted at archival and high-quality encodes (higher CPU, better compression).
- Tunings like film, animation, grain, and stillimage refine settings for content type.
THandBrake adds convenient GUI-level preset selection and parameter groups to make repeating workflows easier across many files.
Recommended settings: streaming
Goal: clean, consistent stream with low encoder delay and predictable bandwidth.
General recommendations:
- Preset: faster or veryfast (choose based on CPU capacity and target resolution).
- Tune: zerolatency for live streaming; omit for streamed VOD encoding if latency isn’t a concern.
- Rate control: CBR or constrained VBR with a set max bitrate. For platform-specific targets, follow platform bitrate recommendations (e.g., 4500–6000 kbps for 1080p60 on many platforms).
- Keyframe interval (GOP): 2 seconds (i.e., FPS * 2) for segmenters and player seeking consistency.
- Profile/level: high profile for high-res; choose level that matches the platform/player capability (e.g., Level 4.2 for 1080p60).
- B-frames: 0–2 for lower latency; many streamers set B-frames to 0 with zerolatency.
- Buffer size (VBV): set bitrate and buffer to platform recommended values to avoid bitrate spikes.
- Audio: AAC-LC, 48 kHz, bitrate 128–320 kbps depending on music/voice mix.
- Container: MP4 or fragmented MP4 (fMP4) for many HLS/DASH workflows; MKV for local intermediate if needed.
Example starting preset (THandBrake fields):
- Preset name: Stream 1080p60
- x264 preset: veryfast
- Tune: zerolatency
- Rate control: CBR 6000 kbps
- Keyframe interval: 120 (assuming 60 fps)
- B-frames: 0
- Profile: high, Level: 4.2
- Audio: AAC 160 kbps, stereo
Notes:
- If using hardware encoders (NVENC, QuickSync), choose the device-specific preset in THandBrake; hardware encoders can reduce system load but may require higher bitrate for similar quality vs software x264.
- If you need adaptive bitrate outputs, encode multiple streams (e.g., 1080p60 @6000 kbps, 720p60 @3500 kbps, 480p @1500 kbps).
Recommended settings: archival
Goal: smallest file for a given perceived quality, future-proofing, and efficient playback.
General recommendations:
- Preset: medium to slow for best tradeoff; slower/slower for near-archive “best” where encoding time is less important.
- Rate control: CRF for quality where file size is secondary to quality; choose CRF by content and target quality (common range CRF 18–22 for x264).
- CRF ~18: near visually lossless for most source material.
- CRF 20–22: excellent visual quality with meaningful file size reduction.
- Tune: use film for natural motion, animation for cartoons, grain if preserving film grain is critical.
- Profile/level: set to high and a level high enough for resolution/framerate; for archival you can use higher levels to preserve quality.
- B-frames: 3–8 depending on preset; more B-frames typically improves compression.
- Reference frames: 3–5 (more for complex content).
- Entropy coder: CABAC (default).
- Container: MKV for rich metadata and flexibility; MP4 if maximum compatibility with devices is required.
- Color and bit depth: If the source is 10-bit, consider 10-bit x264 or x265 for archival (THandBrake supports settings to preserve bit depth if available).
- Subtitles/chapters/metadata: embed subtitle tracks (SRT or PGS), add chapters, and include descriptive metadata for future retrieval.
Example starting preset (THandBrake fields):
- Preset name: Archive Best Quality 1080p
- x264 preset: slow
- Tune: film
- Rate control: CRF 18
- Profile: high, Level: auto/appropriate
- B-frames: 4
- Ref frames: 4
- Audio: FLAC or high-bitrate AAC (e.g., FLAC for lossless archival audio)
Notes:
- For long-term archival, many archivists now prefer AV1/HEVC for better compression, though H.264 remains widespread for compatibility. THandBrake may help manage H.264 archival workflows; consider keeping a lossless audio track (FLAC) alongside the compressed video.
Testing methodology
- Pick representative samples: include fast motion, dark scenes, high detail, animation, and talking-head shots.
- Encode with multiple candidate presets/settings.
- Measure:
- Bitrate/file size
- Encoding time and CPU usage
- Objective quality: VMAF/SSIM/PSNR (VMAF preferred for perceptual quality)
- Subjective review on target displays and streaming conditions (mobile, desktop, TV).
- Iterate: adjust CRF or bitrate to hit target quality/size tradeoffs.
- Keep a documented matrix of results so presets can be reproduced across batches.
Practical tips and automation
- Use THandBrake’s preset export/import to standardize workflows across machines and team members.
- Batch processing: group similar files (same resolution/framerate) to avoid per-file re-encoding parameter gymnastics.
- Preserve source timestamps and metadata where possible (MKV is useful).
- For streaming, monitor real-world bitrates and viewer buffering; reduce complexity or bitrate if viewers experience stalls.
- For archival, store checksums (SHA256) and maintain a catalog (filename, resolution, codec, CRF/bitrate, checksums).
- Consider two-pass or multi-pass encodes for archival when using ABR: two-pass can give smaller files for a target bitrate but is less convenient than CRF for quality-first archiving.
Troubleshooting common issues
- Washed-out colors after encoding: verify color range and color matrix settings; ensure you’re not unintentionally applying limited/full range mismatches.
- Blockiness at low bitrates: increase bitrate or use a slower preset to improve motion estimation.
- Long encoding times: move from slow -> medium or use hardware acceleration where acceptable.
- Platform rejection: check container/codec/profile/level and ensure keyframe interval and audio codec meet platform specs.
Example preset table (comparison)
Use case | x264 preset | Rate control | Tune | Keyframe (GOP) | B-frames | Container | Audio |
---|---|---|---|---|---|---|---|
Streaming 1080p60 | veryfast | CBR 6000 kbps | zerolatency | 120 | 0 | MP4/fMP4 | AAC 160 kbps |
Streaming 720p60 | faster | CBR 3500 kbps | zerolatency | 120 | 0–2 | MP4/fMP4 | AAC 128–160 kbps |
Archival high | slow | CRF 18 | film | auto | 4 | MKV | FLAC or AAC 320 kbps |
Archival balanced | medium | CRF 20 | film/animation | auto | 3 | MKV | AAC 256 kbps |
Adaptive outputs | mix (hw+sw) | varied | none | 2s | 0–3 | fMP4/HLS | AAC varies |
Final notes
- There is no one-size-fits-all “best” preset: test with your own content and resources.
- For streaming, prioritize low latency, predictable bitrate, and platform compatibility.
- For archival, prioritize quality and compression efficiency; accept longer encode times and richer containers/metadata.
- Use THandBrake to codify your chosen workflows into shareable presets to ensure consistency across encodes and team members.
Leave a Reply