Skip to content

Commit fdf1a1d

Browse files
committed
Add comment when num_frames is none
1 parent 86905c1 commit fdf1a1d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/torchcodec/_core/_metadata.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ def end_stream_seconds(self) -> Optional[float]:
123123

124124
@property
125125
def num_frames(self) -> Optional[int]:
126-
"""Number of frames in the stream. This corresponds to
127-
``num_frames_from_content`` if a :term:`scan` was made, otherwise it
128-
corresponds to ``num_frames_from_header``.
126+
"""Number of frames in the stream (int or None).
127+
This corresponds to ``num_frames_from_content`` if a :term:`scan` was made,
128+
otherwise it corresponds to ``num_frames_from_header``. If it is None,
129+
the number of frames is calculated from the duration and the average fps.
129130
"""
130131
if self.num_frames_from_content is not None:
131132
return self.num_frames_from_content

0 commit comments

Comments
 (0)