Skip to content

Commit 6bdb346

Browse files
committed
Add tutorial on seek_mode
1 parent d5a096c commit 6bdb346

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/source/glossary.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Glossary
1717
A scan corresponds to an entire pass over a video file, with the purpose
1818
of retrieving metadata about the different streams and frames. **It does
1919
not involve decoding**, so it is a lot cheaper than decoding the file.
20+
The :class:`~torchcodec.decoders.VideoDecoder` performs a scan when using
21+
``seek_mode="exact"``, and doesn't scan when using
22+
``seek_mode="approximate"``.
2023

2124
clips
2225
A clip is a sequence of frames, usually in :term:`pts` order. The frames

src/torchcodec/decoders/_video_decoder.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
class VideoDecoder:
2323
"""A single-stream video decoder.
2424
25-
This decoder always performs a :term:`scan` of the video.
2625
2726
Args:
2827
source (str, ``Pathlib.path``, ``torch.Tensor``, or bytes): The source of the video.
@@ -51,9 +50,13 @@ class VideoDecoder:
5150
Default: 1.
5251
device (str or torch.device, optional): The device to use for decoding. Default: "cpu".
5352
seek_mode (str, optional): Determines if frame access will be "exact" or
54-
"approximate". Exact guarantees that requesting frame i will always return frame i,
55-
but doing so requires an initial :term:`scan` of the file. Approximate is faster as it avoids scanning the
56-
file, but less accurate as it uses the file's metadata to calculate where i probably is. Default: "exact".
53+
"approximate". Exact guarantees that requesting frame i will always
54+
return frame i, but doing so requires an initial :term:`scan` of the
55+
file. Approximate is faster as it avoids scanning the file, but less
56+
accurate as it uses the file's metadata to calculate where i
57+
probably is. Default: "exact".
58+
Read more about this parameter in:
59+
:ref:`sphx_glr_generated_examples_approximate_mode.py`
5760
5861
5962
Attributes:

0 commit comments

Comments
 (0)