<@701030996430159872> Following up on this! I was testing renderStill() with imageFormat: 'webp' expecting it to be transparent based on your message, but it was coming out with a solid white background.
I dug into the @remotion/renderer source code to see why, and it looks like the omitBackground flag passed to Puppeteer is strictly hardcoded to only be true for PNGs.
In packages/renderer/src/take-frame.ts (and screenshot-dom-element.ts), I found this:
const buf = await screenshot({ page: freePage, omitBackground: imageFormat === 'png', // <-- This forces false for 'webp' path: (wantsBuffer ? undefined : output) ?? undefined, type: imageFormat, // ... });
Because of imageFormat === 'png', when I pass imageFormat: 'webp', omitBackground evaluates to false. As a result, Puppeteer never sends the Emulation.setDefaultBackgroundColorOverride command to CDP, and Chrome paints a solid white background before capturing the WebP.
From message posted on Discord by nandushaji
<@701030996430159872> Following up on this! I was testing renderStill() with imageFormat: 'webp' expecting it to be transparent based on your message, but it was coming out with a solid white background.
I dug into the @remotion/renderer source code to see why, and it looks like the omitBackground flag passed to Puppeteer is strictly hardcoded to only be true for PNGs.
In packages/renderer/src/take-frame.ts (and screenshot-dom-element.ts), I found this:
const buf = await screenshot({ page: freePage, omitBackground: imageFormat === 'png', // <-- This forces false for 'webp' path: (wantsBuffer ? undefined : output) ?? undefined, type: imageFormat, // ... });Because of imageFormat === 'png', when I pass imageFormat: 'webp', omitBackground evaluates to false. As a result, Puppeteer never sends the Emulation.setDefaultBackgroundColorOverride command to CDP, and Chrome paints a solid white background before capturing the WebP.