[FFmpeg-user] Converting BT2020 HVEC Videos to H.264 without Color Washout

Pavel Koshevoy pkoshevoy at gmail.com
Thu Mar 25 23:09:47 EET 2021


On Thu, Mar 25, 2021 at 9:27 AM Craig L. <ffmpeg at trafficality.com> wrote:

> I recently started finding certain videos were washing out upon H.264
> conversion.
>
>
> After doing some research I found that if I added -color_primaries
> bt2020 to the command, the color would come out correctly, but ONLY if
> the video was played in Quicktime.  When played in Chrome, it would look
> washed out.
>
> Here is a link to a screengrab showing the video in quicktime on the
> left and in Chrome on the right.  Same video.
>
>
> *https://snipboard.io/N8nYv0.jpg* <https://snipboard.io/N8nYv0.jpg>
>
>
>
>
> After much research I can't figure out how to handle this?
>
> What is the correct way to convert these videos that I suppose are 10
> bit HDR  into H.264 so that they will play correctly in Chrome, etc.
>
>
>
> This is my current command:
>
> /usr/local/bin/ffmpeg  -i "156237-Video2.mov"   -filter_complex
> "scale=480:270"  -color_trc smpte2084 -color_primaries bt2020 -c:v
> libx264 -profile:v high -pix_fmt yuv420p -level 5.1 -preset ultrafast
> -movflags faststart       -vsync 2  -c:a aac -b:a 128k     -y
> 156237-Video2.mov-16-9-1616621202.mp4
>
>
>
>
>

For best possible player compatibility you really need to convert from
HDR10 to SDR (bt709).

To do that you need to use either colorspace or zscale ffmpeg filter.  The
colorspace filter didn't support HLG the last time I checked, but that
wouldn't matter if your source is HDR10, not HLG.
Since you'd be converting from high dynamic range to standard dynamic range
you would also need to use the tonemap filter.

There is probably a LUT file somewhere that implements HDR10 -> BT709 color
space conversion and tone mapping in one step, skipping zscale/tonemap.  If
you had such LUT you could use it with lut3d filter.

Pavel.


More information about the ffmpeg-user mailing list