Skip to content

Instantly share code, notes, and snippets.

@goyuix
Created July 16, 2021 23:22
Show Gist options
  • Save goyuix/033d35846b05733d77f568b754e7c3ea to your computer and use it in GitHub Desktop.
Save goyuix/033d35846b05733d77f568b754e7c3ea to your computer and use it in GitHub Desktop.
How to use FFMPEG to convert HDR video to SDR (standard dynamic range) while (mostly) retaining the same depth and intensity of colors, without washed-out colors, as the original HDR10+ video.
ffmpeg -i video-input.mp4 -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -c:v libx265 -crf 22 -preset medium -tune fastdecode video-output.mp4
@JohnnyPh
Copy link

JohnnyPh commented Oct 1, 2024

Thank you. This still helpful after 3 years.

@ShadowVlican
Copy link

wow it indeed works pretty good

@qBLACKTIGERq
Copy link

Thank you a lot, kind stranger

@kilorat
Copy link

kilorat commented Feb 10, 2025

I googled for how to do this, and that led me here. Thanks for the solution, now my videos don't have washed out colors!

@loirotv
Copy link

loirotv commented Mar 2, 2025

Really helpful! I've been struggling with this for 2 hours until I found your code. Thanks!

@MelanX
Copy link

MelanX commented Mar 29, 2025

Does this work with all common HDR content? Like HDR10+, and Dolby Vision and I don’t know what else? But sounds good, will test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment