[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:
https://www.reddit.com/r/ffmpeg/comments/bu8znh/advice_for_preserving_colours_from_png_rgb_to/
and then used this Facebook post for reference:
https://www.facebook.com/permalink.php?story_fbid=2413101932257643&id=100006735798590
and it still didn't work :((
If anyone can tweak my commands below to work properly, that would be
perfect.
I'm not attached to any particular video codec.

Here is the original image (attached as rainbow.png):
https://drive.google.com/open?id=15ny3ROv0JduYdSd3k8vSvna96oA9KIou
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):
https://drive.google.com/open?id=12wgVPPzdp2Qi-tEMBoVg-3E8CIZW6Jvh
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,
Tom
-------------- 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