Skip to content

Instantly share code, notes, and snippets.

@sturmen
Created March 26, 2025 12:28
Show Gist options
  • Select an option

  • Save sturmen/2dccc6524b32c2c4e99a5864604b6bd2 to your computer and use it in GitHub Desktop.

Select an option

Save sturmen/2dccc6524b32c2c4e99a5864604b6bd2 to your computer and use it in GitHub Desktop.
FFMpeg HDR Command Cheat Sheet

Manipulating HDR Footage with FFMpeg

There's not a lot of obvious documentation about how to work with non-SDR color spaces and transfer functions, especially for fixing issues. That's where this gist comes in.

Fixing an improperly tagged MOV File

This changes the metadata, losslessly fixing the improperly tagged file so that you don't have to re-encode.

ffmpeg -hide_banner -i input.mov -movflags write_colr+write_gama -c:v copy -colorspace 9 -color_primaries 9 -color_trc 16 -map_metadata 0 -c:a copy -movflags +faststart output.mov

This tags it as 9-16-9, which is the ST.2084 transfer function with BT.2020 color. Other values (such as for HLG aka ARIB STD-B67) can be found here.

Thanks

  • Thanks to /u/finnjaeger1337 for the tag command source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment