Add stream flag to io.read_video
Open
Nobody has claimed this yet.
module: io
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
The torchvision.io.read_video function does not have an option to exclude reading certain streams.
I would like to be able to load the frames of a video without loading audio. In order to do this I had to use internal functions like so:
container = av.open(fileath, metadata_errors='ignore')
info = {}
video_frames = []
video_frames = torchvision.io.video._read_from_stream(container, start, end,
container.streams.video[0], {'video': 0})
info["video_fps"] = float(container.streams.video[0].average_rate)
Obviously this exposes the PyAV backend, therefore I envision two options:
- functions for video only, audio only, and both.
- optional parameters added to the
read_videofunction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at torchvision.io.read_video and the internal _read_from_stream path, then inspect how PyAV streams are selected. Done means the public API supports the requested stream-selection behavior, including video-only loading without audio, while retaining the existing combined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100