Push a studio stream of any codec over RTMP, in H.264

Classic RTMP carries H.264 only, and the RTMP output refused a stream
encoding anything else. Since TeamSpeak streams now prefer the codecs
every client decodes before H.264, that refusal hit the usual case.

An output may now name a video codec of its own. The streamer then runs
an encoder of that codec for the layer the output takes, as it does for
a viewer that chose another codec, and hands those packets to the
outputs that asked for it only; recordings and the replay buffer keep
the stream's codec, which a studio now always encodes for them even
when every viewer chose another one. Only the output's layer gets the
extra encoder, not every simulcast layer.

Tested end to end: a VP8 studio stream pushed to FFmpeg's own RTMP
server arrives as H.264 and AAC (ffprobe), starting at a keyframe, while
a recording of the same stream stays VP8 and Opus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 19:42:02 +03:00
1 parent 02e43b14f9
commit ecc132f5ff
8 files changed
+266 -97

No files matched your search

+5
View File
@@ -145,6 +145,11 @@ viewer: Engine::subscribe_frames ─ VideoPipeline (thread) ─ VideoDecoder
go out through `MediaSink::send_video(frame, codec)`. Sinks that do not
tell codecs apart (`EncodedSource`, a `FrameSource`) get the stream codec
only, so their offers must list it alone (`voelinctl stream start` does).
A studio's outputs count as viewers too: the stream codec always runs
for its recordings and replay buffer, and an output that needs a codec of
its own (RTMP: H.264) gets an encoder of the layer it takes
(`Studio::output_codecs`), whose packets reach only such outputs
(`Studio::write_output_packet`).
- `stats()`: `StreamerStats` with capture fps, convert time and threads,
the GPU path (`gpu_frames`, `gpu_convert_time`, `gpu_error`),
dropped frames, codec, and per layer (`LayerStats`) size, frames,