-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[torchcodec] Add a simple example showing how to decode the first fra…
- Loading branch information
1 parent
d024e7b
commit e863c06
Showing
2 changed files
with
17 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
============= | ||
Basic Example to use TorchCodec to decode a video. | ||
============= | ||
""" | ||
|
||
# A simple example showing how to decode the first few frames of a video. | ||
# using the :class:`~torchcodec.decoders.SimpleVideoDecoder` class. | ||
# %% | ||
from torchcodec.decoders import SimpleVideoDecoder | ||
|
||
video_file_path = __file__ + "../test/decoders/resources/nasa_13013.mp4" | ||
simple_decoder = SimpleVideoDecoder(video_file_path) | ||
num_frames = len(simple_decoder) | ||
print("{video_file_path=} has {num_frames=} frames") | ||
first_frame = simple_decoder[0] | ||
print("{type(first_frame)=}") |
This file was deleted.
Oops, something went wrong.