OBS Plugin MVP implementation#1
Merged
Merged
Conversation
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>
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.
No description provided.