write
Writes one demuxed packet through to the muxer, rebasing and rescaling its timestamps the way Remuxer does. For a caller driving its own read loop: a tee, a recording taken while something else plays, a split on the caller's own boundaries.
The packet stays the caller's, unchanged and open. A REFERENCE is what reaches the muxer, because av_interleaved_write_frame takes ownership of the payload it is given and the rebase rewrites the stream index and the timestamps: handing it the caller's packet would blank the very thing a tee still needs.
Ordering is the caller's to get right. Packets must arrive in the order the muxer expects for the stream, which for a copy of a demuxed stream means the order they were read in.
The output starts at zero where its media starts to show, which a stream's first packet does not always say: B-frames show before the keyframe they follow, and audio can skip its first samples. So the sink keeps a reference to each packet written until every copied audio and video stream has shown where it starts, or a second of decode time has gone by past the earliest start found, or an encoded frame, the header or the close needs the timeline, and then writes them in the order they came. Subtitle and data streams are not waited for.
Throws
when packet is closed, or when this stream's sink is.
Writes one demuxed packet through to the muxer, rebasing and rescaling its timestamps the way Remuxer does. For a caller driving its own read loop: a tee, a recording taken while something else plays, a split on the caller's own boundaries.
The packet stays the caller's, unchanged and open. A REFERENCE is what reaches the muxer, because av_interleaved_write_frame takes ownership of the payload it is given and the rebase rewrites the stream index and the timestamps: handing it the caller's packet would blank the very thing a tee still needs.
Ordering is the caller's to get right. Packets must arrive in the order the muxer expects for the stream, which for a copy of a demuxed stream means the order they were read in.
The output starts at zero where its media starts to show, which a stream's first packet does not always say: B-frames show before the keyframe they follow, and audio can skip its first samples. So the sink keeps a reference to each packet written until every copied audio and video stream has shown where it starts, or a second of decode time has gone by past the earliest start found, or an encoded frame, the header or the close needs the timeline, and then writes them in the order they came. Subtitle and data streams are not waited for.
Throws
when packet is closed, or when this stream's sink is.
Write one demuxed packet through to the muxer: rebase timestamps so the output starts at ~0 (matters for trimmed copies, since players choke on a stream starting at 95s), then rescale from the source stream's time-base onto whatever the output muxer chose. av_interleaved_write_frame takes ownership of the payload; the packet comes back blank.
Writes one demuxed packet through to the muxer, rebasing and rescaling its timestamps the way Remuxer does. For a caller driving its own read loop: a tee, a recording taken while something else plays, a split on the caller's own boundaries.
The packet stays the caller's, unchanged and open. A REFERENCE is what reaches the muxer, because av_interleaved_write_frame takes ownership of the payload it is given and the rebase rewrites the stream index and the timestamps: handing it the caller's packet would blank the very thing a tee still needs.
Ordering is the caller's to get right. Packets must arrive in the order the muxer expects for the stream, which for a copy of a demuxed stream means the order they were read in.
The output starts at zero where its media starts to show, which a stream's first packet does not always say: B-frames show before the keyframe they follow, and audio can skip its first samples. So the sink keeps a reference to each packet written until every copied audio and video stream has shown where it starts, or a second of decode time has gone by past the earliest start found, or an encoded frame, the header or the close needs the timeline, and then writes them in the order they came. Subtitle and data streams are not waited for.
Throws
when packet is closed, or when this stream's sink is.