Search code examples
ffmpegwebmvp9

ffmpeg prores with alpha to webm vp9 renders grey


I've been trying to convert a video encoded in ProRes 4444HQ to webm vp9. I created an example video with a 50% transparent square in it. It should look like this:

what I want

but it looks like this:

what I get

Here is how I'm converting the video:

ffmpeg -i square.mov -c:v libvpx-vp9 -b:v 0 -crf 31 square.webm

I've tried changing color spaces and choosing different profiles but I can't seem to get rid of the grey shadow. Does it have something to do with the conversion from yuva to rgba?


Solution

  • Looks like the ProReS has premultiplied pixels and the MOV from Motion has set a flag in the MOV indicating that but the WebM hasn't / can't, so the browser doesn't compensate.

    Running

    ffmpeg -i square.mov -vf unpremultiply=inplace=1 -c:v libvpx-vp9 -b:v 0 -crf 31 square-premult.webm
    

    should produce a WebM with straight pixels handled correctly by the browser.