FFmpeg – How to encode H265 HDR10 videos from EXR files?
I have a 4K HDR TV and I wanted to see my work directly on it. All my renders with Houdini are done in .EXR 16 bits float, so I have all the information to create to such a video in DNxHD or Apple Prores 10 bits but to create a H265 video in HDR BT2020 (Rec. 2020) ST2084…
Note: As I am using a non commercial version of Houdini, my renderings are limited to 720p HDR but the workflow will work for 4K EXR anyway.
Workflow
My workflow is the following one:
- Setup Houdini and all 3D software to OCIO/ACES
- Import the EXR files in Nuke with OCIO/ACES Enabled
- Fix eventually EXR files that are ACES compliant (like classic linear EXR files)
- Make the compositing/grading in Nuke
- Check the final look on your HDR monitor (if you graphic card allows you to do so)
- Render a specific EXR file sequence (or .mov with DNxHD/Prores 10 bits presets) at the end of your compositing with the correct Colorspace (REC2020 ST2084 1000nits).
- Run a batch with FFMPEG that generates the H265 HDR10 video.
Which files can you open on LG UHD TV?
Here are the highest specifications of the video for LG Full HD and UHD TV:
Full HD Model
- H.264 1920×1080@60P BP/MP/HP@L4.2 20Mbps
- HEVC (H.265) 1920×1080@60P MP@L4.1, Main10 Profile@L4.1 20Mbps
ULTRA HD model
- H.264 1920×1080@60P or 4096×2160@30P BP/MP/HP@L5.1 50Mbps
- HEVC (H.265) 4096×2160@60P MP@L5.1, Main10 Profile@L5.1 50Mbps
Source: https://www.lg.com/ca_en/support/product-help/CT20098005-1437128842789
These specs are important to configure FFMPEG properly.
Connect your UHD TV to your computer!
If you want to make the compositing for a HDR screen, it’s better to finish the color grading on your HDR screen.
Hence take your HDMI 2.0 cable and plug your TV on your computer and activate HDR in Windows.
https://www.windowscentral.com/how-enable-hdr-settings-windows-10#enable_hdr_settings_windows10
At this hour only are compatible the following videocards:
- Nvidia’s GeForce GTX 900, 10-series, 16-series and RTX 20-series
- AMD RX 400 and RX 500 series, Vega graphics cards and Radeon 7
Install / Activate OCIO ACES Color Management
To have access to HDR BT2020 (Rec. 2020) ST2084, you will need to activate the ACES Color Management in all your software (including in Houdini).
Otherwise you will never see the Rec.2020 Colorspace.
In ACES the sRGB visual aspect is more accurate but sensibly darker than sRGB without ACES. So it’s better to see it from the moment you are making your lighting/rendering.
Be sure to have the latest version of ACES on your computer.
DownloadInstall OCIO into a specific folder
Extract the folder aces_1.0.3 from the zipfile to a specific folder on your computer like C:\OCIO\aces_1.0.3
With latest versions of Houdini/Nuke, you can normally remove the baked folder included that is really heavy. If you have some troubles in a software extract the folder again.
Create a specific system variable to access to OCIO (it’s working with Nuke but not with Houdini)
- Go to System properties (WIN+R and enter SystemPropertiesAdvanced)
- Click on the last button Environment Variables…
- In the System Properties part (bottom of the window) click on New
- Enter on the first line (Variable Name):
OCIO
- Enter on the second line (Variable Value):
C:\OCIO\aces_1.0.3\config.ocio
(the path you decided earlier)
Configure OCIO in Houdini
You will need to add a line OCIO in your file houdini.env
.
The file is located in %USERPROFILE%\Documents\HoudiniXX.y
(where XX.y
is your Houdini’s version installed (ie 17.0, 17.5 or 18.0)
Add the following line at the end of the file: OCIO="C:/OCIO/aces_1.0.3/config.ocio"
(change the path accordingly to your configuration)
Activate in the Scene View
To activate the Color Management in the Scene view, right-click on the Eye icon on the bottom-right of the Scene view and check Color Correction.
You should see now the following toolbar :
Click on ACES and tick the box Enable OpenColorIO
Activate in the Render View
To activate the Color Management in the Render view, click on the little arrow on the toolbar that is reduced just above the one where you can do snapshots.
You should see the following toolbar under the render view:
Then click on ACES and tick the box Enable OpenColorIO
You will now see your render with the right colors to produce a HDR10 project.
Configure OCIO in Nuke
As you have entered the system variable OCIO
, your project’s default color management should already linked to your OCIO’s folder (otherwise it means the OCIO variable didn’t work properly).
You can check that by following theses steps:
- Go to the project settings (press S in the Node graph)
- Go the tab Color of the Project Settings that just open on the upper-right of your screen.
- It should look the same than the image under
- Otherwise change it to OCIO

How to render HEVC files ?
You have different options :
- After Effects CC
- Premiere Pro CC
- Final Cut Pro X
- DaVinci Resolve 16
- Nuke + FFMPEG
As After Effects, Premiere and Final Cut Pro X are not free, I have just tried with DaVinci Resolve and a non-commercial version of Nuke combined with FFMPEG.
None of them support H265 export in the free version. So I had to use FFMPEG to render the video in H265.
My worst idea was to bypass DaVinci Resolve or Nuke and try to convert the colorspace direclty in FFMPEG…
After a lot of tries, my preferred workflow was in Nuke.
But I had nice results with DaVinci too, so I will put here the elements that gave me headaches!
DaVinci Resolve 16
The most difficult part were to have the correct FPS for my export and the impossibility to export directly in H265. So I had to work with FFMPEG anyway at the end…
I found that the dynamic was a bit higher with DaVinci than my version from Nuke, but both were looking nice.
How to set up the HDR viewport ?
You will need to setup DaVinci to display HDR videos correctly. Please check the video under:
To get the correct result from standard EXR files, I have setup the Project Setting – Color Management like this:

How to fix the encoder framerate ?
If you try to encode the video and you don’t see the correct framerate (like 23.96 instead of 25 for your sequence), and have already change the frame rate of your sequence, then the framerate to fix is on the timeline.
Follow this short video to fix the issue:
Encode with FFMPEG
Check the section FFMPEG
Nuke
From my experience and from what I have found, let OCIO do its job all in Nuke!
As the color space conversion is done in Nuke, the color/saturation/hue will be correct when you open the video on your TV or on your computer (you can see HDR videofiles with MPC-HC and madVR on a SDR Monitor).
If you have linear EXR files (not ACEScg EXR)
Each time you will import an EXR file that is not ACES compliant, you will need to change the Read’s colorspace from scene_linear (ACEScg)
to Utility – Linear - sRGB
Otherwise, the colours will be oversaturated!

Convert to REC2020 – ST2084
The only thing you will have to do, is to change to the Colorspace in your Write node.
Go to Colorspaces → Output → Rec.2020 ST2084 (1000 nits)

I’m exporting here to EXR files but you can also do a video in Apple ProRes or DNxHD 10 bits, the encoding part is quite the same.
Encode the H265 HDR10 file with FFMPEG
Here is my script to encode with FFMPEG. You can drag and drop any file from an EXR sequence directly from the Explorer and it will work.
FFMPEG Encoder (right-click to save)Here is my script to extract a frame in HDR from an HDR video with FFMPEG. It helped me compare one frame from the DNxHD video produced with DaVinci Resolve with the same encoded with my workflow (nuke doesn’t open .mkv file):
HDR Frame Extractor (right-click to save)View a HDR10 video on a SDR monitor
If you open a HDR10 video directly on your computer and you don’t have an HDR monitor, the colours will be washed out / grey.
To fix this you will need to install MPC HC with Madvr codec
https://codecguide.com/download_k-lite_codec_pack_standard.htm
HDR Video Playback
To play such videos you need to use the included MPC-HC player and select Madvr as the video renderer. Madvr will automatically send the HDR metadata to your TV when it is HDR capable. Otherwise it will convert the video to SDR so you can watch it (with proper colors) on a normal monitor/TV.
You can select Madvr here:
MPC-HC options > Playback > Output > Video Renderer
Or during installation of the codec pack.Note: currently only HDR10 format is supported. Not Dolby Vision.
Klite Codec
Interesting Articles
You can find more details about ACES workflow on this article: https://thevfxdesk.com/2019/04/14/color-space-for-cg-artist-part-ii-acescg/
And more details for ACES integration here https://scivfx.artstation.com/pages/acessetup