Skip to content

Commit

Permalink
fix the doc of time page and av.frame.Frame.dts according to
Browse files Browse the repository at this point in the history
  • Loading branch information
zzjjbb authored and WyattBlue committed Nov 23, 2023
1 parent 39832c4 commit 895630b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion av/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/api/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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..

Expand Down

0 comments on commit 895630b

Please sign in to comment.