You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fe2f37a
Browse filesBrowse the repository at this point in the historyBrowse files
perf(export): decode H.264 in software on the macOS export walk
An export of a 1080p60 High-profile recording costs 1.296x the ffmpeg
floor instead of 1.819x. Same pixels, same bitstream, same audio.
WHAT THE CODE SAID, AND WHY IT WAS WRONG. `Decoder::open` already
preferred the software decoder for Baseline, with a measurement to back
it (VT 215 fps, software 3000 fps on a Constrained Baseline capture) and
this claim next to it:
Au-delà de Baseline (High, 10 bits, HEVC, 4K) l'arbitrage s'inverse :
le décodeur logiciel devient le goulot et VT reprend l'avantage.
That claim was asserted, not measured — the figure quoted beside it came
from a Baseline clip. Measured on High, the software decoder still wins,
and by a lot.
MEASURED. Mac mini M1 8 GB / macOS 26.5, screen-recorder-benchmark S4
scenario (wallpaper, padding, radius, shadow, three zooms, motion blur,
rendered cursor, webcam PiP), source 1920x1080@60 60 s profile High,
output 1080p60 H.264. Three cycles, one ffmpeg floor per cycle, variant
order rotated, closing drift 1.0002, machine 85-88 % idle:
VideoToolbox 32 079 ms 1.819x floor (MAD 34 ms)
software 22 863 ms 1.296x floor (MAD 16 ms) -28.7 %
Per stage, from `OPENSCREEN_EXPORT_PROFILE=1`:
decode.screen 13.130 s -> 1.024 s
decode.webcam 4.204 s -> 0.291 s
The reason is the one the Baseline note already gives, and it does not
depend on the profile: VideoToolbox has a FIXED per-frame latency and
allocates a CVPixelBuffer for each one, where the software decoder
spreads the work over cores that are plural. What matters is that the
frame is cheap enough to decode — which 1080p 8-bit is.
THE OUTPUT DOES NOT MOVE. `h264_videotoolbox` is not byte-reproducible:
two runs of the same input give different files. The difference is one
byte, at offset 51, inside an SEI NAL — strip SEI and 49 MB of bitstream
are identical. So equivalence is checked as md5 of the SEI-stripped
bitstream and of the decoded YUV, both of which are stable. All six
outputs across both variants match on bitstream, pixels and audio.
SCOPE, DELIBERATELY NARROW. `DecodeIntent` splits preview from export
rather than changing the default outright:
- The preview was not measured. It reads in real time and scrubs, so
seek latency may matter more than throughput there. Changing it
without measuring it would be the same mistake this commit fixes.
- 4K, 10-bit and HEVC were not measured. They keep VideoToolbox. The
condition is `codec_id == H264 && format == YUV420P`, so anything
else falls through unchanged.
Windows and Linux gain `open_for_export` as a delegating alias so
`timeline_walk` stays portable; neither changes behaviour.
`[pipeline] décodage <file> : <backend>` now goes to stderr on every
open. Without it, "the export is slow" and "the export took
VideoToolbox" are indistinguishable in a bug report.
0 commit comments