Skip to content

OBS Plugin MVP implementation#1

Merged
wtarit merged 16 commits into
masterfrom
dev/rawstream
Jun 8, 2026
Merged

OBS Plugin MVP implementation#1
wtarit merged 16 commits into
masterfrom
dev/rawstream

Conversation

@wtarit

@wtarit wtarit commented Apr 18, 2026

Copy link
Copy Markdown
Owner

No description provided.

wtarit and others added 16 commits April 16, 2026 21:53
Customize template for Option B architecture (plugin spawns scrcpy
subprocess, reads MPEG-TS over loopback TCP). See DECISION.md for
full rationale.

- Customize buildspec.json, plugin-main.c, README, locale for scrcpy-obs
- Add scrcpy submodule (wtarit/scrcpy, pinned v3.3.4)
- Whitelist CLAUDE.md, DECISION.md, scrcpy/ in template .gitignore
- Add CLAUDE.md (Claude context) and DECISION.md (architecture ADR)
Abandon MPEG-TS + PR #6721 path. New plan: tiny scrcpy fork patch
that tees server-client video packet stream (12-byte header + NAL)
to a TCP port; plugin reads those packets directly into libavcodec.

Drops libavformat dependency, removes mid-stream IDR sync bug,
shrinks fork-maintenance surface. Updates fork branch convention
from streamsink/* to rawstream/*.
Ports forward the reusable pieces of the stream-sink prototype:

- src/scrcpy-process.{c,h}: cross-platform child process spawn
  (Win32 CreateProcessW+job object, POSIX posix_spawn).
- src/scrcpy-source.{c,h}: OBS source type with properties
  (serial, video source, camera-id, max-size, bitrate, codec),
  ephemeral-port picker, child spawn on activate.
- src/plugin-main.c: registers scrcpy_source_info.
- CMakeLists.txt: FFmpeg via avcodec/avutil/swscale (no avformat).
- cmake/finders/FindFFmpeg.cmake: obs-deps-compatible finder.

Child is spawned with the new --raw-video-tcp=PORT flag (to be
implemented in the scrcpy fork patch on rawstream/v3.3.4). Plugin
side uses a scrcpy_reader stub for now; decode path follows once
the fork patch is in place.

Explicitly NOT ported from the prototype:
- src/scrcpy-demuxer.{c,h} (MPEG-TS demux via avformat_open_input)
- --stream-sink=... flag wiring
- --video-codec-options=i-frame-interval:int=1 (was a stream-sink
  init-phase workaround; raw stream emits a config packet + first
  IDR without it).
Points future-me (and Claude across sessions) at branch dev/rawstream,
the two existing commits, the stash with stream-sink WIP, and the
fork-patch blocker.
Bump scrcpy submodule to v3.3.4-rawstream.1 (adds --raw-video-tcp=PORT
that tees the server->client video packet stream over loopback TCP).
scrcpy-reader.c now connects, parses the 12-byte prelude + per-packet
headers, runs the scrcpy packet-merger pattern (buffer CONFIG, prepend
to next media packet), decodes via avcodec, and hands YUV frames to
obs_source_output_video. Validated in OBS against a Pixel 9 Pro XL:
live settings-app preview via GetSourceScreenshot.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@wtarit wtarit merged commit 57f57e3 into master Jun 8, 2026
4 checks passed
@wtarit wtarit deleted the dev/rawstream branch June 8, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant