[FFmpeg-user] PNG to video without any colour range loss?

Thomas Howe thomashowemain at gmail.com
Tue Jun 11 23:12:19 EEST 2019

Hi all,

I'm trying to make a video from a single .png file where the colours are
preserved properly, but I can't figure it out.

I posted on Reddit:
and then used this Facebook post for reference:
and it still didn't work :((
If anyone can tweak my commands below to work properly, that would be
I'm not attached to any particular video codec.

Here is the original image (attached as rainbow.png):
It is a 1920x1080 image for screenshotting purposes, with containing a
100x640 rainbow pattern in the top left corner.

To turn this into a video, as per the Facebook advice, I used this:
ffmpeg -loop 1 -i rainbow.png -c:v libx265 -x265-params lossless -pix_fmt
yuvj420p -t 5 rainbow.mp4

and then extracted a frame like this:
ffmpeg -ss 00:00:02 -i rainbow.mp4 -vframes 1 rainbow-extract.png

and then took screenshots for comparison from SMPlayer, and YouTube (both
Firefox and Chromium).
Here is an annotated comparison (attached as rainbow-comparisons.png):
The screenshots all look very similar. Something I find odd is that the
extracted frame is visibly slightly different to the source picture.

Anyways, any help appreciated,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rainbow-comparisons.png
Type: image/png
Size: 60318 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20190611/1cc76bdf/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rainbow.png
Type: image/png
Size: 11693 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20190611/1cc76bdf/attachment-0001.png>

More information about the ffmpeg-user mailing list