Skip to content

convert_recording: add --crf and --preset knobs#188

Merged
borisbat merged 1 commit into
masterfrom
bbatkin/convert-preset-crf-knobs
Jun 6, 2026
Merged

convert_recording: add --crf and --preset knobs#188
borisbat merged 1 commit into
masterfrom
bbatkin/convert-preset-crf-knobs

Conversation

@borisbat

@borisbat borisbat commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Surfaced while recording dasImguiImplot's realtime_scroll: a full-motion clip — the whole plot scrolls every frame — defeats H.264 inter-frame compression and ran 2.77 MB at the defaults, ~2× the other tutorials.

The fix is to compress harder without touching quality: a slower x264 preset. --crf 23 --preset veryslow lands the same clip at 1.54 MB with visually identical lines. Raising --crf to hit the size instead (tried 32 → 1.59 MB) introduced visible mosquito noise on the dark background — exactly the quality this clip can't spare.

Changes

  • --crf <int> (default 23, unchanged) — libx264 quality. Existing recordings re-encode the same.
  • --preset <string> (default medium, unchanged) — libx264 preset; use veryslow for full-motion clips.
  • skills/recording.md documents both, with the rule: shrink full-motion clips via --preset, not by raising --crf.

Defaults are unchanged, so this is purely additive — no effect on any existing recording's pipeline.

🤖 Generated with Claude Code

Surfaced recording dasImguiImplot's realtime_scroll: a full-motion clip (the whole
plot scrolls every frame) defeats H.264 inter-frame compression and ran 2.77 MB at
the defaults, ~2x the other tutorials. The fix is to compress harder WITHOUT touching
quality: a slower x264 preset. crf 23 + --preset veryslow lands the same clip at
1.54 MB with visually identical lines (no mosquito noise on the dark background -
raising crf to 32 to hit the size would have introduced exactly that).

- --crf <int> (default 23): libx264 quality, unchanged default so existing recordings
  re-encode the same.
- --preset <string> (default medium): libx264 preset; veryslow for full-motion clips.

skills/recording.md documents both and the "shrink via --preset, not --crf" rule.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends utils/convert_recording.das with additional libx264 encoder knobs so tutorial recordings that are “full-motion” (e.g., constantly scrolling plots) can be made smaller by using a slower x264 preset rather than increasing CRF (which can introduce visible artifacts).

Changes:

  • Add --crf <int> CLI option (default 23, unchanged behavior unless overridden).
  • Add --preset <string> CLI option (default medium, unchanged behavior unless overridden) and pass it through to ffmpeg’s libx264 encoder.
  • Document the recommended approach for full-motion clips in skills/recording.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
utils/convert_recording.das Adds crf and preset CLI fields and threads them into the ffmpeg libx264 args.
skills/recording.md Documents when/how to use --preset vs --crf for full-motion recordings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/recording.md
Comment on lines +92 to +97
Mostly-static recordings (a plot with a brief gesture) land ~0.5–0.8 MB at the defaults. A
**full-motion** clip (e.g. a realtime scroll, where every frame is a full-frame change) defeats
H.264 inter-frame compression and runs several MB. Shrink it the lossless way — add
`--preset veryslow` (better compression at the **same** quality), **not** by raising `--crf`
(which trades away the quality the clip needs). `--crf` stays at the clean default `23`; both are
knobs only for this case.
@borisbat borisbat merged commit eff2551 into master Jun 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants