[FFmpeg-user] Question about colorspace conversion

Pavel Koshevoy pkoshevoy at gmail.com
Tue Nov 26 00:32:42 EET 2019

On Mon, Nov 25, 2019 at 9:28 AM <m_cik at o2.pl> wrote:
> I'm little confused about using colorspace conversion, transformation
> characteristics. What I'm doing is extracting frames from HDR movie to PNG
> files(PNG files will be used in another project). I run following command:
> `ffmpeg -i data/hdr_movie.mkv -pix_fmt rgb48be -s:v 1920x1080
> -color_primaries 9 -color_trc 16 -colorspace 9 -color_range 1
> frames/frame_%06d.png`
> ffprobe for data/hdr_movie.mkv is `Video: hevc (Main 10), yuv420p10le(tv)`
> If I run the ffmpeg command, do I really convert colorspace? Or do I
> specify colorspace of output frame? Should I also run proper filter, which
> will do conversion? And additional question, what is the order of
> converting steps? colorspace, characteristics, matrix?

That's probably not doing any conversion.  To convert you need to use
a filter like colorspace (doesn't support HLG) or zscale.

There was a very helpful guide for HDR to SDR conversion with ffmpeg
-- https://stevens.li/guides/video/converting-hdr-to-sdr-with-ffmpeg/
The URL returns a Not Found now, but you can still read it via
archive.org (although that seems to miss some screenshots) --

Hope this helps,

More information about the ffmpeg-user mailing list