convert_recording: add --crf and --preset knobs#188
Merged
Conversation
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>
There was a problem hiding this comment.
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 (defaultmedium, 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 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 veryslowlands the same clip at 1.54 MB with visually identical lines. Raising--crfto 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; useveryslowfor full-motion clips.skills/recording.mddocuments 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