Fix a slow render or preview
Check with stills and drafts, draw frames in parallel, and find out which stage of a frame is slow.
npx kinetograph bench src/index.tsx --frame 30npx kinetograph bench html/index.html --frame 30Don't render the whole video to check one thing. Look at the frames you care about, and render a draft before the final.
Look first, render later
stilldraws one frame andstripdraws a contact sheet. Both take a fraction of a render.render --draftdraws at half size, which is the same as--scale 0.5.still,stripandoniontake--scaletoo.render --range 40..90draws only those frames.
npx kinetograph strip src/index.tsx -n 12 --scale 0.5
npx kinetograph render src/index.tsx --draft --range 0..90npx kinetograph strip html/index.html -n 12 --scale 0.5
npx kinetograph render html/index.html --draft --range 0..90Draw frames in parallel
render --concurrency <n> draws several frames at once in worker threads. The default is half your cores, at most 4, and --concurrency 1 draws every frame in the main thread. The file is the same either way. Rarely, two renders at the same concurrency differ by 1 in one colour channel on a few pixels, so use --concurrency 1 for a bit-exact render. See What works.
Find the slow part
npx kinetograph bench src/index.tsx --frame 30
npx kinetograph bench src/index.tsx --range 40..90npx kinetograph bench html/index.html --frame 30
npx kinetograph bench html/index.html --range 40..90bench prints the milliseconds each stage of a frame takes, from your code (js) to the GPU stages (raster, composite, readback). A large js means your component code is slow. A large raster or composite points at the drawing: big effects, blurs, many layers or big images. Run it as NODE_ENV=production npx kinetograph bench ..., because it uses React's development build otherwise.
Other things that help
- A smaller composition or a lower
--scaledraws fewer pixels. See 4K rendering. doctordoesn't time anything. It lists what the engine can't draw, which a render would warn about frame after frame.- Studio draws its preview with the same engine, so a heavy frame is slow there too. Pick a composition or a span to look at rather than playing the whole video.