[FFmpeg-devel] [PATCH 0/1] avformat/movenc: fix HEVC fmp4 HLS init segment for Apple playback
David McElroy
david at mcelroy.online
Tue Jul 22 00:01:46 EEST 2025
Hi FFmpeg developers,
This patch fixes a bug that makes HEVC fmp4 HLS streams generated by FFmpeg
unplayable on all Apple platforms (macOS/iOS Safari, QuickTime, etc.).
The issue is a malformed init segment, as detailed in the commit message.
A similar patch was proposed in November 2023 by Jay Zhang,
but it was never merged.
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/317173.html
**To Reproduce the Bug:**
You can generate a problematic HLS init segment using a command like this on
the current master branch:
$ ffmpeg -i ../BigBuckBunny_short.mp4 -c:v libx265 -f hls -hls_segment_type fmp4 playlist.m3u8
**Sample Files:**
To make review easier, I've uploaded two sample streams produced with that
command from that file from latest master (commit 9c9b41b)
with and without the patch applied:
- Source file: https://david.mcelroy.online/ffmpegbug/examples/BigBuckBunny_short.mp4
- Broken stream (from master): https://david.mcelroy.online/ffmpegbug/examples/9c9b41b/playlist.m3u8
- Fixed stream (with this patch): https://david.mcelroy.online/ffmpegbug/examples/patched/playlist.m3u8
These links can be loaded directly in Safari to see the playback issue.
- Broken init segment (from master): https://david.mcelroy.online/ffmpegbug/examples/9c9b41b/init.mp4
- Fixed init segment (with this patch): https://david.mcelroy.online/ffmpegbug/examples/patched/init.mp4
You may also note that when selected in Finder, the broken init segment fails
to be recognized as HEVC video, while the fixed one is recognized correctly.
I also ran `make fate` to ensure no regressions were introduced and all
tests passed.
The commit contains the full technical details of the fix.
Thanks,
David McElroy
David McElroy (1):
avformat/movenc: fix HEVC fmp4 HLS init segment for Apple playback
libavformat/movenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.34.1
More information about the ffmpeg-devel
mailing list