diff --git a/av/video/frame.py b/av/video/frame.py index 970ecc4b8..1606a6858 100644 --- a/av/video/frame.py +++ b/av/video/frame.py @@ -312,6 +312,22 @@ def pict_type(self): def pict_type(self, value): self.ptr.pict_type = value + @property + def key_frame(self): + return super().key_frame + + @key_frame.setter + def key_frame(self, v): + if v is None: + return + if v: + self.ptr.flags |= lib.AV_FRAME_FLAG_KEY + self.pict_type = PictureType.I + else: + self.ptr.flags &= ~lib.AV_FRAME_FLAG_KEY + if self.pict_type == PictureType.I: + self.pict_type = PictureType.P + @property def colorspace(self): """Colorspace of frame.