msd/python demuxer - #1679
Open
NicolasHug wants to merge 1 commit into
Open
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1679
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unrelated FailureAs of commit 7b1883e with merge base 0d3103d ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
NicolasHug
force-pushed
the
msd/python-demuxer
branch
from
September 1, 2026 14:46
4b7c9fc to
eaba58b
Compare
NicolasHug
force-pushed
the
msd/python-demuxer
branch
from
September 2, 2026 11:06
eaba58b to
a0b1b60
Compare
NicolasHug
force-pushed
the
msd/python-demuxer
branch
2 times, most recently
from
September 2, 2026 12:52
a0b1b60 to
cd6ec59
Compare
NicolasHug
force-pushed
the
msd/python-demuxer
branch
from
September 2, 2026 13:41
cd6ec59 to
6992a78
Compare
NicolasHug
force-pushed
the
msd/python-demuxer
branch
from
September 2, 2026 13:46
6992a78 to
cd6ec59
Compare
NicolasHug
force-pushed
the
msd/python-demuxer
branch
from
September 2, 2026 13:47
cd6ec59 to
633319b
Compare
Demuxer(source, streams=...) is the user-facing half of the multi-stream
work. Streams are chosen once, at construction, and never change:
demuxer = Demuxer("video.mp4", streams=("video", "audio"))
video, audio = demuxer.streams
decoders = {s.index: s.make_decoder() for s in demuxer.streams}
for packet in demuxer:
decoder = decoders[packet.stream_index]
for out in (decoder.drain() if packet.is_eof
else decoder.decode(packet)):
...
A selector is "video", "audio" or an int container index, alone or in a
tuple, plus a standalone "all" for every audio and video stream. The order
given is the order of .streams. Selecting the same stream twice raises, as
does selecting a subtitle or data stream - "all" is the way to say "skip
those" rather than "report them".
Streams are objects rather than bare indices because scan() belongs to video
and to nothing else: VideoStream has it, AudioStream simply doesn't, so the
rule is enforced by the type rather than by an error message. They are also
where make_decoder() lives, so a decoder is built from the stream it decodes
and no second container is opened.
seek() takes the stream to resolve against. FFmpeg resolves a seek in one
stream's time base and lands on that stream's keyframes, so with two video
streams only the named one is exact - the docstring says so rather than
implying both are equally seekable. We deliberately do not seek to
"somewhere safe for everything": that needs keyframe knowledge we don't
always have, and it would silently land earlier than asked.
VideoDemuxer and AudioDemuxer are now Demuxer pinned to one stream, and
behave as before. Their packet decoders keep public constructors for now:
removing those is tied to whether these two classes survive at all, which is
still open.
New op _blocks_demuxer_stream_media_types reports each stream's media type,
so selectors resolve without opening the container twice.
NicolasHug
force-pushed
the
msd/python-demuxer
branch
from
September 2, 2026 13:51
633319b to
7b1883e
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with GitHub Stacks CLI • Give Feedback 💬