Tools & IDEs Bug Report

HEVC MP4 rejected by QuickTime and Safari: the hev1 vs hvc1 sample entry tag

We switched our video pipeline to HEVC to halve storage and Apple users got a black player or a crossed-out play button. The codec was fine; the MP4 sample entry said hev1 and Apple players want hvc1. A remux with -tag:v hvc1 fixed it without re-encoding.

Amara Nwosu Amara Nwosu @amaranwosu · November 18, 2026 · 7 min read · 283 Views
583-hevc-mp4-quicktime-hev1-vs-hvc1-tag

Our course platform stores thousands of hours of lecture video. To cut storage and bandwidth we moved the transcoding pipeline from H.264 to HEVC (H.265) for 1080p renditions, keeping H.264 as a fallback for browsers without HEVC support. Android and Windows test devices with HEVC decoding played the new files. Then the iPhone and Mac users, the very group we expected to benefit most because Apple hardware has decoded HEVC for years, started reporting a black player.

In Safari the <video> element showed a crossed-out play icon. Downloading the file and opening it in QuickTime Player gave the familiar dialog:

The document "lecture-0412-1080p.mp4" could not be opened.
The file isn't compatible with QuickTime Player.

Reproducing it

Any file from the new pipeline failed in Safari on macOS and iOS and in QuickTime Player. The same source encoded by a designer with an Apple export preset played fine, and its file size and bitrate were similar. Same codec, same resolution, different result.

What we ruled out

  • HEVC profile. Both files were Main profile, 8-bit, yuv420p, level 4.0. Apple devices decode that.

  • Audio. Both used AAC-LC. Stripping audio from the bad file did not help.

  • Server headers. The file failed when opened from disk too, so Content-Type and range handling were not the cause.

Root cause

ffprobe showed one difference between the files: the video stream's codec tag. Our pipeline's files had codec_tag_string=hev1; the Apple-exported file had hvc1. Both are valid MP4 sample entry types for HEVC, defined in the ISO standard for carrying NAL-unit video in MP4. Apple's players accept hvc1 and reject hev1 in MP4 files, and Apple's HLS authoring specification requires hvc1 for HEVC.

What is happening under the hood

To start decoding HEVC, a decoder needs parameter sets: the VPS, SPS and PPS that describe resolution, profile and coding tools. MP4 offers two ways to carry them:

Sample entry

Where parameter sets live

Consequence

hvc1

In the sample description (the hvcC box), available before the first frame

Player can configure the decoder up front

hev1

May be in the sample description or in-band, inside the video samples

Player may have to find them in the stream

Apple's media framework expects the hvc1 arrangement. Faced with hev1, it refuses the track rather than searching the stream for parameter sets. Other players, including Chrome where HEVC hardware decoding is available and VLC, accept both.

The encoder decides nothing here; the muxer writes the tag. ffmpeg's MP4 muxer wrote hev1 for our HEVC streams because we never told it otherwise. The libx265 encoder produced parameter sets in its extradata, which is everything an hvc1 sample entry needs, so the bitstream itself was already compatible.

Environment

Component

Version / value

Pipeline

ffmpeg 8.0 with libx265, running in Linux containers

Output

MP4, HEVC Main, 1080p, yuv420p, AAC-LC

Players failing

Safari 26 on macOS and iOS, QuickTime Player

Players working

Chrome 141 on Windows with hardware HEVC, VLC 3.0

Command before fix

ffmpeg -i in.mov -c:v libx265 -crf 24 -c:a aac out.mp4

Minimal reproduction

ffmpeg -i in.mov -c:v libx265 -crf 24 -preset medium -c:a aac -b:a 128k out.mp4
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,codec_tag_string -of csv=p=0 out.mp4
hevc,hev1

Who is affected

Anyone producing HEVC MP4 or fragmented MP4 for Apple devices with tools that default to hev1: ffmpeg-based pipelines, some cloud transcoders with custom settings, some camera and drone apps. For HLS, the same problem appears as a playlist whose CODECS attribute starts with hev1., or segments whose init section carries an hev1 entry.

The fix

1. Remux existing files, no re-encode. Changing the tag is a container operation. -c copy keeps the encoded video and audio bit for bit and takes seconds even for long lectures:

ffmpeg -i lecture-0412-1080p.mp4 -c copy -tag:v hvc1 -movflags +faststart lecture-0412-1080p.fixed.mp4

We ran it across the library with a small loop that skipped files already tagged correctly:

#!/usr/bin/env bash
set -euo pipefail
for f in renditions/*-1080p.mp4; do
  tag=$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_tag_string -of csv=p=0 "$f")
  [[ "$tag" == "hev1" ]] || continue
  ffmpeg -nostdin -loglevel error -i "$f" -c copy -tag:v hvc1 -movflags +faststart "${f%.mp4}.tmp.mp4"
  mv "${f%.mp4}.tmp.mp4" "$f"
  echo "retagged $f"
done

2. Set the tag in the encoding step. New encodes now write hvc1 directly:

- ffmpeg -i in.mov -c:v libx265 -crf 24 -preset medium -c:a aac -b:a 128k out.mp4
+ ffmpeg -i in.mov -c:v libx265 -crf 24 -preset medium -tag:v hvc1 \
+   -c:a aac -b:a 128k -movflags +faststart out.mp4

The same flag applies to hardware encoders such as hevc_videotoolbox, hevc_nvenc or hevc_qsv; it is a muxer setting, not an encoder setting.

3. Fix the HLS playlist. For HLS renditions we regenerated the init segments with the same tag and made sure the master playlist's CODECS string used the hvc1 form, for example CODECS="hvc1.1.6.L120.90,mp4a.40.2".

4. Serve a fallback anyway. The page lists HEVC first and H.264 second, so browsers without HEVC still play:

<video controls playsinline preload="metadata">
  <source src="/v/lecture-0412-1080p.mp4" type='video/mp4; codecs="hvc1.1.6.L120.90"'>
  <source src="/v/lecture-0412-1080p-h264.mp4" type='video/mp4; codecs="avc1.640028"'>
</video>

The type attribute with an hvc1 codec string lets each browser skip a source it cannot play without downloading it.

Alternatives and trade-offs

  • Re-encode with an Apple tool. Works, but it is slow and loses quality for no reason when the bitstream is already fine.

  • Drop HEVC for Apple users. Throws away the bandwidth savings for exactly the devices with the best HEVC support.

  • Rely on a cloud transcoder's Apple preset. Fine if you use one; check the output tag anyway, because custom settings can change it.

How to test the fix

ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,codec_tag_string,profile,pix_fmt -of csv=p=0 lecture-0412-1080p.fixed.mp4
hevc,Main,hvc1,yuv420p

Then open the fixed file in QuickTime Player, play it in Safari from our staging site on macOS and iOS, and check in the browser console that the element really chose the HEVC source:

document.querySelector('video').currentSrc;

Confirming in production

We track which source each player picked and whether playback started within five seconds. After retagging, Safari sessions that picked the HEVC source went from roughly 0 percent successful starts to the same 99 percent start rate as H.264, and CDN egress for Apple users fell by about 40 percent because they now actually get the smaller files.

Regression guard

  • The transcoding job runs ffprobe on every output and fails if an HEVC stream does not carry the hvc1 tag.

  • Our HLS packager config is covered by a test that parses the master playlist and rejects any CODECS value starting with hev1.

  • A weekly sample of new uploads is played on a real iPhone in the device lab.

Security implications

None. The tag change is a metadata fix inside the container and does not alter access control, URLs or the encoded data. As always, run ffmpeg on user uploads in an isolated worker with resource limits and keep it up to date.

Prevention checklist

  • Always pass -tag:v hvc1 when writing HEVC into MP4 for Apple devices.

  • Check codec_tag_string with ffprobe as part of the pipeline, not after complaints.

  • Use -c copy remux to fix tags; do not re-encode.

  • Keep an H.264 fallback source with a precise codecs string.

  • Validate HLS CODECS attributes against the same rule.

References

Add a label

#safari #ffmpeg #hevc #mp4 #quicktime
Written by
Amara Nwosu @amaranwosu

I build and maintain public and partner APIs, currently for a logistics platform with web, mobile and third-party clients all calling the same endpoints. Before that I worked on identity: login, sessions, OAuth integrations and the long tail of edge cases they create. The bugs I care about sit at the contract between client and server. A PUT that wiped fields the client never sent, a cache that served one user's page to another, a field removal that broke app versions still in the wild, a refresh flow that logged people out when two tabs raced. None of these show up in a happy-path demo. My posts walk through how each one surfaced, what the HTTP or auth spec actually says, the fix we shipped and the tests we added so the next change to the API does not repeat it.

Advertisement

Comments

0

No comments yet. Be the first to comment!

Sign In to post a comment.