Keep iPhone HDR when cutting and joining videos with ffmpeg
Short answer: stream-copy (-c copy) whatever you can, and when you must re-encode, encode 10-bit HEVC and pass the colour tags through: -c:v libx265 -pix_fmt yuv420p10le -tag:v hvc1 -color_primaries bt2020 -color_trc arib-std-b67 -colorspace bt2020nc. Leaving the tags out is what turns iPhone footage flat and grey.
What the iPhone actually records
Check your file first:
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,profile,pix_fmt,color_primaries,color_transfer,color_space \
-of default=nw=1 IMG_1234.MOV
A typical HDR recording reports hevc, Main 10, yuv420p10le, bt2020, arib-std-b67 (that is HLG) and bt2020nc, with a Dolby Vision configuration in the side data. Portrait videos are stored landscape (1920×1080) with a −90° rotation in the display matrix.
Why the export goes grey
HLG pixels shown as if they were ordinary BT.709 look washed out. That is exactly what happens when an encode drops the three colour tags: the pixels are fine, but the player no longer knows they are HDR. A second cause is converting to 8-bit (yuv420p) on the way, which also bands the gradients of a blue sky or court.
Re-encode without losing HDR
ffmpeg -i IMG_1234.MOV -map 0:v:0 -map 0:a:0 \
-c:v libx265 -preset fast -crf 19 -pix_fmt yuv420p10le -tag:v hvc1 \
-color_primaries bt2020 -color_trc arib-std-b67 -colorspace bt2020nc \
-c:a aac -b:a 192k -movflags +faststart out.mp4
-tag:v hvc1makes QuickTime, Photos and iOS accept the HEVC in an MP4.-map 0:a:0picks the AAC track. Newer iPhones also record a spatial-audio track that ffmpeg cannot decode; mapping every stream fails withCould not find codec parameters.- Re-encoding applies the rotation, so a portrait video comes out as real 1080×1920 with no rotation flag — usually what you want for social apps.
- Dolby Vision metadata is not carried through a libx265 re-encode. iPhone Dolby Vision is profile 8.4, whose base layer is HLG, so the result is still HDR on Apple devices.
Joining clips: one encode, not concat-copy
Trimming each rally with -c copy and gluing the clips with the concat demuxer looks lossless, but on real iPhone footage it produced a permanent 1.01 s audio offset and broken frames at the joins. Trim from the source inside one filter graph and encode once instead — the full explanation and command.
Previews that look grey are not proof
Tools that grab a JPEG frame from HLG video without tone mapping (many ffmpeg builds have no zscale) show a grey frame even when the video is correct. Check the tags with ffprobe and play the file on an HDR screen.
Or let the tool do it
Tennis Evolution cuts tennis rallies out of iPhone recordings this way: lossless keyframe-aligned clips, one reel encoded with the HDR tags passed through, labels drawn as PNG overlays (no drawtext needed), and a check that each output decodes cleanly with audio and video starting together.
FAQ
Why does my iPhone video look washed out after ffmpeg?
The encode dropped the HDR colour tags (bt2020 / arib-std-b67 / bt2020nc) or converted to 8-bit, so players show HLG pixels as standard video. Add -pix_fmt yuv420p10le and the three -color_* flags.
Does ffmpeg keep Dolby Vision when re-encoding iPhone video?
Not with libx265: the Dolby Vision metadata is dropped. iPhone footage uses Dolby Vision profile 8.4 with an HLG base layer, so a correctly tagged re-encode still plays as HDR.
Why does ffmpeg fail with Could not find codec parameters on iPhone videos?
Newer iPhones add a spatial-audio track that ffmpeg cannot decode. Map the video and the AAC track explicitly, for example -map 0:v:0 -map 0:a:0.
Do I need tone mapping to export iPhone HDR?
Only if the destination accepts SDR only. To keep HDR, do not tone map; pass the HLG tags through.