From 895630bcae7c25a083c584ef0c08460e6d934fb4 Mon Sep 17 00:00:00 2001 From: zzjjbb <31069326+zzjjbb@users.noreply.github.com> Date: Tue, 21 Mar 2023 00:23:48 -0400 Subject: [PATCH] fix the doc of `time` page and `av.frame.Frame.dts` according to https://ffmpeg.org/doxygen/5.1/structAVFrame.html#aa52951f35ec9e303d3dfeb4b3e44248a --- av/frame.pyx | 4 +++- docs/api/time.rst | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/av/frame.pyx b/av/frame.pyx index 352b68157..50be5b8c9 100644 --- a/av/frame.pyx +++ b/av/frame.pyx @@ -66,7 +66,9 @@ cdef class Frame: property dts: """ - The decoding timestamp in :attr:`time_base` units for this frame. + The decoding timestamp copied from the :class:`~av.packet.Packet` that triggered returning this frame in :attr:`time_base` units. + + (if frame threading isn't used) This is also the Presentation time of this frame calculated from only :attr:`.Packet.dts` values without pts values. :type: int """ diff --git a/docs/api/time.rst b/docs/api/time.rst index 35e4cfc85..fd65de1a2 100644 --- a/docs/api/time.rst +++ b/docs/api/time.rst @@ -38,7 +38,7 @@ Attributes that represent time on those objects will be in that object's ``time_ >>> float(video.duration * video.time_base) 6.72 -:class:`.Packet` has a :attr:`.Packet.pts` ("presentation" time stamp), and :class:`.Frame` has a :attr:`.Frame.pts` and :attr:`.Frame.dts` ("presentation" and "decode" time stamps). Both have a ``time_base`` attribute, but it defaults to the time base of the object that handles them. For packets that is streams. For frames it is streams when decoding, and codec contexts when encoding (which is strange, but it is what it is). +:class:`.Packet` has a :attr:`.Packet.pts` and :attr:`.Packet.dts` ("presentation" and "decode" time stamps), and :class:`.Frame` has a :attr:`.Frame.pts` ("presentation" time stamp). Both have a ``time_base`` attribute, but it defaults to the time base of the object that handles them. For packets that is streams. For frames it is streams when decoding, and codec contexts when encoding (which is strange, but it is what it is). In many cases a stream has a time base of ``1 / frame_rate``, and then its frames have incrementing integers for times (0, 1, 2, etc.). Those frames take place at ``pts * time_base`` or ``0 / frame_rate``, ``1 / frame_rate``, ``2 / frame_rate``, etc..