6

Update January 2025: This remains an open question. Current answers below do not solve the issue.


I'd like to convert a file recorded from an iPhone 12 to a royalty-free version (for upload to Wikimedia, Flickr, etc). So the transfer involves:

Source (iPhone proprietary-encumbered) Destination (royalty-free)
4k 60fps (UHD, not DCI) 4k 60fps
BT.2020 in HLG (WCG) BT.2020 in HLG (WCG)
Frame-level dynamic HDR metadata in Dolby Vision profile 8.4 Frame-level dynamic HDR metadata in HDR10+
HEVC VP9 (open to AV1 as well but that's likely more nascent)
Bitrate is 31 Mb/s Fine with higher bitrate to maintain same SSIM/PSNR
Audio is in AAC Audio to Vorbis/OGG

According to https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/ it should be possible to do most of this. Anyone can help me cook up the right command for this?

MyPreciousss
  • 376
  • 1
  • 3
  • 13

2 Answers2

2

Although you have already posted and accepted a negative answer in How to convert Dolby Vision HDR to HDR10+? from 2021, there might exist a method for this conversion.

The recommended tool is ACES from DaVinci Resolve 18. This professional suite is free for personal use.

You will find a description of the method to use in the YouTube video Convert iPhone Dolby Vision to HDR10, described as:

Hi, in this video, I’m going to show you how to convert the iPhone 12 and 13 series' rec2020 HLG (dolby vision) to rec2020 pq or HDR10, that is compatible with more devices like Roku or chromecast when uploading to YouTube. I’ll be using ACES in DaVinci Resolve to achieve this.

Also in the end screen, I've included two videos that I made using this method, one being iPhone 12 Dolby Vision, the other was video from my iPhone 11 Pro shot in rec709 SDR.

harrymc
  • 498,455
1

ffmpeg

A command line as

ffmpeg -i someFile.mp4  -c:a libvorbis -c:v libvpx-vp9 -b:v 3.8M  outFile.webm

will convert to

  • -c:v libvpx-vp9 VP9
  • -c:a libvorbis Audio to Vorbis/OGG
  • -b:v 3.8M ~31 Mb/s, but you can change according to your wishes

not changing the original resolution nor the FPS.

HDR10+

As for HDR metadata in HDR10+, in the same link posted by the OP (in the updated section Extracting and encoding with HDR10+ metadata), there is an explanation of how to extract the metadata and use it, for example, via the dhdr10-info option in x265-params.

  1. Download download a copy of hdr10plus_parser from quietviod’s repo.

  2. Check your video has HDR10+ info that it can read

    ffmpeg -loglevel panic -i input.mkv -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser --verify -
    
  3. Extract and save in the file metadata.json

    ffmpeg -i input.mkv -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser -o metadata.json -
    
  4. Use in your expression...

    ffmpeg.exe -i input.mkv -c:v libx265 -pix_fmt yuv420p10le -x265-params "colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1016,115:hdr10=1:dhdr10-info=metadata.json" -crf 20 -preset medium "output.mkv"
    
Hastur
  • 19,483
  • 9
  • 55
  • 99