FFMPEG / ACES workflow for SDR and HDR deliverables

Hi everyone, I’m a new member so please forgive my unsuitable-like questions :slight_smile:

I want to render in Resolve (ACES color science 1.0.3) 2 masters:

  1. EXR ACEScc as intermediate
  2. EXR ACES2065 for log-term storage

I’m trying compile a script in FFMPEG to convert EXR ACEScc intermediate into deliverables (sRGB h264 SDR 1080p, bt2020 h265 4k hdr10 and so on…) but FFMPEG does not work with EXR ACEScc when converting in h265, even with correct master display params set and baked LUT from OpenColorIO applied.
The point is that FFMPEG does not recognize AP0 and AP1 primaries or ACES input stream, so the x265 matrix correction does not work properly. old h264 codec works fine but is not 2020 HDR. Here 2 screenshot:


FFMPEG x265 HDR from ACEScc


FFMPEG h264 sRGB with no LUT applied

I found a solution rendering a ProRes in 2020 HDR and making h265 deliverables from that.
Does any one know a way to use x265 FFMPEG with ACEScc intermediate and not the ProRes?
THX a lot :slight_smile:

What ffmpeg command have you tried?

assuming
INPUT = ProRes 4444XQ, 4k dci scope 2.39, bt2020, st2084, 1000nits, level “auto”
this very basic version of the syntax works well (vimeo hdr flag is ok):

ffmpeg -i INPUT -c:v libx265 -x265-params “colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:max-cll=1000,400:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,0.0050)” OUTPUT

First of all- the upper screenshot indicates that the pipeline has some implicit conversion into a YUV-model colorspace that is not properly round-tripped back; I think this should be addressed first.

Second- you shouldn’t be using ACEScc at all in any rendered file. ACEScc is only to be used internally by the color-grading software (Resolve in your case, when you select ACEScc in the Color Management options). All your rendered files should be in ACES2065-1 colorspace.

Third- What LUT are you using from OpenColorIO for mapping into the output colorspace of your choice? Converting from AP0 primaries to BT709 (sRGB) or BT2020 (HDR) primaries can be easily done using ffmpeg's command-line; the same goes from ACES2065-1 (linear characteristics) into BT1886 or ST2084 gamma. Using a LUT from OpenColorIO might still be more accurate though (I’m not sure what equations ffmpeg is using)

Just to conclude an old topic… the green image has nothing to do with ACES. If you read the ffmpeg output closely, you will see it’s encoding gbrp pixel format as a best guess closest to the source. Most HEVC playback software do not understand this. The x264 encoder doesn’t know about planar formats so it makes a better guess. You just need to specify a different pixel format like -pix_fmt yuv420p10le (assuming you have compiled x265 with 10-bit support).

Anyway, I’m not sure why are you using ACEScc instead of linear as an intermediate file format.

Edit: I realized the x265 documentation is not very clear about 10-bit support so I made a pull request to add this option to MacPorts.

1 Like

thanks Elliott, after several studies I realized that ffmpeg is not suitable to do color space conversions when handling 32bit footage. I’m now trying different command line solutions with openimageio (oiiotools) ap0-to-somedisplay piping stdout to ffmpeg. not easy but usefull :slight_smile: