Brings in the portal dialog entry, the studio's person segmentation
(tract-onnx) and the Share button's menu. In docs/studio.md's status
table the segmentation rows join this branch's camera and RTMP rows
(RTMP is no longer a seam). docs/ui.md no longer says the engine cannot
tell a viewer the layers (a Voelin streamer lists them) nor that the
background effect has no segmentation model.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
On Windows the studio listed only the test pattern: there was no camera
backend.
`camera::mf` lists cameras with MFEnumDeviceSources (the symbolic link as
the id, the friendly name, every native format with its sizes and rates)
and captures one with an IMFSourceReader on a thread of its own: the
native format nearest the wanted size, the fastest up to the wanted rate,
handed out as NV12 at that size. With advanced video processing on, the
reader decodes MJPEG and converts the other formats itself, so every
camera reaches the compositor the same way, through the same pacer, pool
and background filter as on Linux. COM and Media Foundation are started
on those threads only, so the caller's apartment does not matter.
Never run: it is type-checked for x86_64-pc-windows-gnu (clippy with
-D warnings, also --all-targets), as nothing here runs Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blur, image and colour backgrounds were cut around a centred oval: no
segmentation model was in the build. `segment::HumanSeg` (feature
`segment`, on by default) now runs PP-HumanSeg, PaddleSeg's portrait
segmentation model as OpenCV Zoo ships it (Apache-2.0, 6 MB, bundled in
crates/voelin-media/models with its licence and SHA-256), on the CPU with
tract-onnx: the frame squeezed to 192x192 RGB, the probability of a person
per pixel out as the mask. It is the default segmenter; the model is
parsed and optimised once per process on the segmentation thread, and if
it does not load the oval stands in. Builds without the feature keep the
oval.
One mask takes about 50 ms on one core (tract is optimised in dev builds
too, as voelin-media already is; unoptimised it took 430 ms), so the 10
masks a second cost about half a core. A new test checks the model loads,
the mask size, that an empty evenly lit room has next to nobody in it, and
the time per mask; the frame-path tests now use the oval explicitly, since
they need a mask known in advance. On a photo of a person the mask
follows the silhouette, arms and legs included (checked by eye; the photo
is not committed). Not yet tried with a camera.
The notices list the model and its licence; THIRD_PARTY_NOTICES.md is
regenerated for tract and its dependencies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a share that granted a portal restore token, every later share
passed the stored token, and xdg-desktop-portal restored the earlier
choice without showing its picker: on Wayland the share dialog's only
source, "Choose via system dialog", never showed a dialog again, and
nothing could change what was shared.
That entry now never sends the token, so the portal always asks (and may
grant a new token, which is stored as before). With a stored token the
share dialog lists a second entry, "Same as last time", which restores
the last choice without the dialog. The studio's portal sources are added
without a token and ask every time; docs/studio.md claimed the token was
written back into the scene, which the UI does not do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Many USB cameras offer their large sizes only as MJPEG (the Fifine K420:
2560x1440 and 1920x1080 compressed, raw only up to 1280x720), and the
studio camera offered PipeWire raw formats only, so it was stuck at 720p.
MJPEG is now offered and decoded with zune-jpeg (already in the tree
through `image`) straight into pooled RGBA frames, on a thread of its own:
the camera thread copies each picture into a recycled buffer and hands it
over latest-wins, so a slow decode drops pictures instead of holding up
the camera, and nothing is allocated per picture once running. The offers
come from what V4L2 lists for the camera: the wanted size at the wanted
rate in a raw format first (no decoding), then the wanted size with MJPEG
first, then every format at the sizes it lists; PipeWire's V4L2 source
otherwise took a size on trust and failed to set NV12 at 1440p.
zune-jpeg is built optimised in dev builds like the other per-pixel code:
unoptimised, a 1440p picture took most of a second.
Tested on the Fifine K420: 2560x1440, 1920x1080 and 1280x720 arrive at
the right size at 10 fps, which is what the camera sends in this light
(v4l2-ctl measures the same); a camera-like 1440p picture decodes in about
30 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RTMP output was a seam that refused every rtmp:// URL. Broadcast
services (Twitch, YouTube, nginx-rtmp) take RTMP, so the studio could only
reach the few that speak WHIP.
The connection is libavformat's own rtmp:// and rtmps:// protocols,
loaded at runtime with the rest of FFmpeg and never linked. Its RTMP
writer takes an FLV byte stream and sends each tag as a message, so the
FLV is ours (onMetaData, AVC and AAC sequence headers, a tag per frame)
and no muxer struct (AVFormatContext, AVStream, codec parameters, which
all moved between releases) is used: five avio functions and
AVIOInterruptCB. Write errors only land in AVIOContext.error, which moved
too (120 bytes in libavformat 58, 84 in 63); it is found at load by
flushing a context whose write callback fails with a sentinel.
Video is the studio's H.264 of one layer as encoded; other codecs are
refused with the reason. Audio is the studio's Opus decoded and encoded
as AAC-LC by FFmpeg's own codecs on the output's thread. The encoder's
sample format has no AVOption, so AVCodecContext.sample_fmt is located
from its neighbours' option offsets like hw_frames_ctx; its 1024-sample
frames are a reference to the first decoded frame (FFmpeg filled in the
channel layout, whose field moved) with only the leading fields pointed
at our planes.
The stream key comes from the URL or the token (sent as the play path)
and never shows in the output's name. The first connection is made when
the output is added, so a wrong address fails there; later failures are
reconnected with backoff (1 s doubling to 30 s), each new connection
starting at a keyframe it asks for, and the stats show why it is down.
EndStream unpublishes; a dead network is cut off after three seconds.
Tested against FFmpeg's own RTMP server (ffmpeg -listen 1): a studio
stream through the hardware H.264 encoder and a 440 Hz tone arrives as
h264 320x180 and aac 48 kHz stereo per ffprobe, starts at a keyframe,
decodes, and comes back after the server is replaced; the unit tests
also pass against FFmpeg 4.4.8. voelinctl studio run gets --rtmp.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What each part shows, how it opens for a screenshot and what of the
engine it uses; how the window of its own shares the controller; the
studio.ui setting; the sample studio; its limits. docs/studio.md points
there and says that another background effect restarts a source's
input. The headless example also drops XDG_SESSION_TYPE, as the script
now does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The segment docs promised a bilinear, feathered mask; the frame path
samples the nearest mask pixel and relies on the mask's own soft edge.
Say so, here and in docs/studio.md, rather than promise a smoothing that
is not there: a model's sharper mask will want it, and that is the place
to add it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The studio had module docs but no page saying how its parts fit, what
the UI drives it with, which settings it keeps, and what is tested for
real against what only compiles. docs/studio.md covers the scene format
(with an example), the compositor and its numbers, cameras, background
replacement and the fact that no person segmentation model is in the
build yet, the outputs, the controller's commands and events and the
preview tap, the engine's hooks and settings keys, the voelinctl
commands, and the verification status. docs/media.md points to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>