From 4a1aa619d2926d2ab11dfd150ca13a2c4860450a Mon Sep 17 00:00:00 2001 From: Nyanmisaka Date: Fri, 22 Apr 2022 17:36:36 +0800 Subject: [PATCH] Fix H264 level on safari fmp4 --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 162a821f5..006fd8861 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1062,10 +1062,12 @@ namespace MediaBrowser.Controller.MediaEncoding } else if (string.Equals(state.ActualOutputVideoCodec, "h264", StringComparison.OrdinalIgnoreCase)) { - // Clients may direct play higher than level 41, but there's no reason to transcode higher. - if (requestLevel >= 41) + // Transcode to level 5.1 and lower for maximum compatibility. + // h264 4k 30fps requires at least level 5.1 otherwise it will break on safari fmp4. + // https://en.wikipedia.org/wiki/Advanced_Video_Coding#Levels + if (requestLevel >= 51) { - return "41"; + return "51"; } } }