<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- libavcodec/videotoolboxenc.c.orig	2021-12-11 09:44:23.000000000 -0500
+++ libavcodec/videotoolboxenc.c	2021-12-11 09:42:05.000000000 -0500
avcodec/videotoolboxenc: Fix non-B-Frame encoding
* Sets vtctx-&gt;has_b_frames to 0 if the VideoToolbox compression session will not emit B-frames (and, in consequence, no valid DTSs).
* Required for the handling of invalid DTSs in 'vtenc_cm_to_avpacket' (line 2018ff) to work correctly and not abort encoding with "DTS is invalid" when no B-frames are generated.
* See: https://trac.ffmpeg.org/ticket/9439
@@ -1516,7 +1516,10 @@
     if (!status &amp;&amp; has_b_frames_cfbool) {
         //Some devices don't output B-frames for main profile, even if requested.
         // HEVC has b-pyramid
-        vtctx-&gt;has_b_frames = (CFBooleanGetValue(has_b_frames_cfbool) &amp;&amp; avctx-&gt;codec_id == AV_CODEC_ID_HEVC) ? 2 : 1;
+        if (CFBooleanGetValue(has_b_frames_cfbool))
+            vtctx-&gt;has_b_frames = avctx-&gt;codec_id == AV_CODEC_ID_HEVC ? 2 : 1;
+        else
+            vtctx-&gt;has_b_frames = 0;
         CFRelease(has_b_frames_cfbool);
     }
     avctx-&gt;has_b_frames = vtctx-&gt;has_b_frames;
</pre></body></html>