For a while now, iPhone’s have shot video in Dolby Vision HDR (High Dynamic Range) by default. This means you have a wider range of color in your videos, as well as a wider range of brightness. HDR is nice because you can have very bright and very dark areas in a single video. Below is a test video I recorded.
Unfortunately there are a lot of problems with HDR, especially Dolby Vision. While it is a fantastic technology that looks great in movies, HDR footage is difficult to edit. Additionally, when posted to to platforms like Instagram and TikTok, HDR footage brightens the user’s screen. I have seen many people on TikTok complaining about this and I personally find that is dramatically harms the viewing experience.
The solution to this is to convert the video to SDR (Standard Definition Range). This is the good old regular video that doesn’t cause weird issues on social media. While it might not have the color range and contrast of HDR, it results in a much better and more reliable viewing experience.
The problem with this is that the conversion process is a bit complex. Most desktop video editing apps export in SDR by default, but they don’t always handle HDR footage well. For instance, below is what happens by default when the above video is processed by Kdenlive (a fantastic free video editor).
As you might be able to see the video looks very washed out. If you are watching on a device that doesn’t support HDR, then both videos probably look bad. This is another issue with HDR, and why we will be converting to SDR.
Converting to SDR
To convert a video to SDR you need to use a process called tonemapping. Tonemapping allows us to convert the iPhone video’s BT.2020 color space to the BT.709 color space. To do this I used a command-line tool called FFmpeg. FFmpeg is a fantastic tool for video editing, transcoding, and other complex video operations. Here is the command i used:
ffmpeg -i IMG_6373.MOV -vf zscale=transfer=linear,tonemap=hable:peak=5,zscale=transfer=bt709,format=yuv420p,colorspace=all=bt709 video.mkv
This might seem like a daunting command, but this is what the options mean.
-i IMG_6373.MOV | This is the name of the input video |
-vf | This indicated that the next argument will be the video filter options |
zscale=transfer=linear | This linearizes the video. I don’t actually know what this means but you have to do it for the tonemap filter to accept the frames. |
tonemap=hable:peak=5 | We are using the Hable algorithm. Hable preserved details while sacrificing color accuracy. If you want to focus on color accuracy use mobius instead. I set the peak to 5 here but you might need to test different values for this to get the right brightness. To preview these options use the ffplay tool like this: ffplay [filename] -vf [filter options] |
zscale=transfer=bt709 | Undo the linear thing and format as BT.709 color |
format=yuv420p | Format the pixels as YUV 4:2:0. This is a way of storing color information. There are other options but this is the most compatable with browsers and apps. |
colorspace=all=bt709 | Not exactly sure what this does but if you don’t put it the metadata is all wrong and some players will break. I forgot this one and the video looked fine in VLC but terrible after uploading to TikTok. Don’t leave this out. |
video.mkv | This is the video file we will output to. You might want to make it an MP4 file for comparability, but I generally prefer MKV. |
In summary, HDR is annoying and editing it is a pain. Fortunately you can easily convert your HDR videos to fantastic SDR videos.
Leave a Reply