mpv icon indicating copy to clipboard operation
mpv copied to clipboard

colors are not correct when creating webp in encode mode

Open tremd opened this issue 5 years ago • 4 comments

mpv 0.32.0-791-g73be20143e FFmpeg version: N-99820-g2ddd6afd30 vo=x11

What's wrong?

  1. the colors between png and webp are totally different.
  2. size of webp is equal even if lower "screenshot-webp-compression=6". It's seems the var has no influence.
  3. webp looks very bad, the size say all. it's not lossless.

mpv log file taking png screenshot https://0x0.st/ide1.log mpv log file taking webp screenshot https://0x0.st/idej.log

webp screenshot https://0x0.st/ideA.webp png screenshot https://0x0.st/idem.png

tremd avatar Nov 02 '20 22:11 tremd

You don't have --screenshot-webp-lossless so it's obvious the webp would not be lossless.

Colorspace mismatch sounds like an actual bug though.

sfan5 avatar Nov 02 '20 23:11 sfan5

Sorry post wrong webp mpv log file. even with --screenshot-webp-lossless mpv create the same small suspicious .webp

https://0x0.st/idew.log https://0x0.st/ideA.webp

tremd avatar Nov 02 '20 23:11 tremd

There's another issue with your approach: You are not taking a screenshot. --o=0.00001.ts.png extracts a frame using the encoding mode, the screenshot options don't affect it. If you want to encode a lossless webp use -ovc libwebp -ovcopts lossless=1.

sfan5 avatar Nov 03 '20 09:11 sfan5

It's actually worse than that. I noticed I was getting wrong colors on both gifs and webp when converting videos to them in ffmpeg. So I tried this filter:

-vf "libplacebo=color_primaries=bt709:color_trc=13:format=gbrp"

For gifs it corrects the color, but for webp it does absolutely nothing.

I think the problem is in ffmpeg.

If I recall correctly ffmpeg webp support was broken for many years until fairly recently, it just doesn't seem to get much attention.

As for mpv, it refused to play webps at all (I think webp support in ffplay might still be broken?).

This is the first time i hear about encoding in mpv but it seems like it's just done as a middleman for ffmpeg.

Rabcor avatar Jun 01 '25 10:06 Rabcor