Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8856 closed defect (invalid)

Wrong colors (pink overlay) in webm video created from png image

Reported by: bers Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
The file output_bad.webm has wrong colors (pink overlay):

  • when shown as a preview icon in Windows 10
  • when played in Google Chrome 84
  • when included in a MS PowerPoint (2016) presentation

How to reproduce:

# Get image file
curl https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/SMPTE_Color_Bars.svg/500px-SMPTE_Color_Bars.svg.png > input.png

# Convert according to instructions: https://trac.ffmpeg.org/wiki/Encode/VP9#constantq:~:text=Constant%20Quality,-In
ffmpeg -i input.png -c:v libvpx-vp9 -crf 30 -b:v 0 output_bad.webm

ffmpeg -i input.png -c:v libvpx-vp9 output_also_bad.webm

# Compare to other format
ffmpeg -i input.png output_good.mp4

# I also tried a palette like here https://stackoverflow.com/q/58832085/
ffmpeg -i input.png -vf palettegen palette.png
ffmpeg -i input.png -i palette.png -lavfi paletteuse -c:v libvpx-vp9 -crf 30 -b:v 0 output_still_bad.webm

Reproduced using ffmpeg 3 on OpenSUSE LEAP 15.1, and using ffmpeg 4.3 on Windows 10.

With some different input data (different set of png files), the problem only occurs only with "-crf 30 -b:v 0", but not without. With yet different input data, it does not happen at all.

Attachments (3)

Snapshot.png (22.8 KB ) - added by bers 4 years ago.
input.png (1.8 KB ) - added by bers 4 years ago.
output_bad.webm (2.0 KB ) - added by bers 4 years ago.

Download all attachments as: .zip

Change History (7)

by bers, 4 years ago

Attachment: Snapshot.png added

by bers, 4 years ago

Attachment: input.png added

by bers, 4 years ago

Attachment: output_bad.webm added

comment:1 by bers, 4 years ago

It's not easy/possible to see with a single frame, but VLC playes multi-frame videos created like this just fine.

comment:2 by pdr0, 4 years ago

Resolution: invalid
Status: newclosed

There is no problem for ffmpeg; it's a playback problem it's "gbrp" because input is rgb24 png

ffplay plays it normally

Convert to YUV if you need YUV VP9 compatible with other programs like chrome

eg.
ffmpeg -i input.png -c:v libvpx-vp9 -vf format=yuv420p -crf 30 -b:v 0 yuv420p.webm

comment:3 by bers, 4 years ago

Thank you. Now that you mentioned gbrp, this sounds a lot like https://video.stackexchange.com/q/24582, which has some more explanation.

comment:4 by bers, 4 years ago

One final bit of information:

With some different input data (different set of png files), the problem only occurs only with "-crf 30 -b:v 0", but not without.

That was inaccurate, I found. It was due to the fact that the gganimate::ffmpeg_renderer (https://gganimate.com/reference/renderers.html) uses pix_fmt = "yuv420p" as default option, but this is not used when other options are passed without pix_fmt. Mea culpa.

Note: See TracTickets for help on using tickets.