Skip to content

perf(media): encode lossless alpha Normalize at libvpx's fastest speed - #383

Merged
rponeawa merged 1 commit into
mainfrom
fix/fast-lossless-alpha-normalize
Oct 8, 2026
Merged

rponeawa merged 1 commit into
mainfrom
fix/fast-lossless-alpha-normalize

Conversation

@rponeawa

@rponeawa rponeawa commented Oct 8, 2026

Copy link
Copy Markdown
Member

Closes #382.

Alpha sources are normalized to lossless VP9, which ran at libvpx's slowest defaults. Lossless output decodes to the same pixels at every speed setting, so the encode now adds -row-mt 1 -deadline realtime -cpu-used 8.

Measured on a 2 s 1080x1920 alpha clip (ffmpeg 9.0.1, 10 cores):

Before After
Default threads 7.65 s 0.88 s
-threads 1 20.04 s 2.15 s
File size 6.2 MB 7.1 MB

Decoded framemd5 is identical before and after, including the single-thread run. The opaque libx264 path is unchanged.

Lossless VP9 decodes to the same pixels at every speed setting, so the
alpha encode now passes -row-mt 1 -deadline realtime -cpu-used 8. On a
2 s 1080x1920 alpha clip this takes the encode from 7.65 s to 0.88 s
with identical decoded frames.

Reported in #382.
@rponeawa
rponeawa merged commit 06daf6f into main Oct 8, 2026
7 of 8 checks passed
@rponeawa
rponeawa deleted the fix/fast-lossless-alpha-normalize branch October 8, 2026 14:04
SanHsien pushed a commit to SanHsien/hypit that referenced this pull request Oct 24, 2026
hypit-ai#383)

Lossless VP9 decodes to the same pixels at every speed setting, so the
alpha encode now passes -row-mt 1 -deadline realtime -cpu-used 8. On a
2 s 1080x1920 alpha clip this takes the encode from 7.65 s to 0.88 s
with identical decoded frames.

Reported in hypit-ai#382.

(cherry picked from commit 06daf6f)
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.

Normalize: lossless VP9 for alpha sources runs at libvpx's slowest defaults (~9x faster with identical output)

1 participant