39 lines
1.3 KiB
Markdown
39 lines
1.3 KiB
Markdown
# Go FFmpeg WeChat Stream Demo
|
|
|
|
Standalone demo: Go finds the visible WeChat window, starts FFmpeg `avfoundation` screen capture, crops to the WeChat window rectangle, and serves an MJPEG stream locally.
|
|
|
|
If FFmpeg screen capture does not produce frames, the demo automatically falls back to macOS window-only capture with `screencapture -l <window_id>`. This captures the WeChat window itself, so other windows covering it should not appear in the stream.
|
|
|
|
Run:
|
|
|
|
```bash
|
|
cd demos/go-ffmpeg-wechat-stream
|
|
go run .
|
|
```
|
|
|
|
Open:
|
|
|
|
```text
|
|
http://127.0.0.1:8765/
|
|
```
|
|
|
|
Options:
|
|
|
|
```bash
|
|
go run . -input 3:none -fps 15 -port 8765 -open=true -wait=true
|
|
```
|
|
|
|
Notes:
|
|
|
|
- macOS only.
|
|
- Requires FFmpeg installed and available in `PATH`.
|
|
- Requires Screen Recording permission for the terminal/app running the demo.
|
|
- WeChat must be visible on screen.
|
|
- By default the demo waits until a visible WeChat window is found. Use `-wait=false` to fail immediately.
|
|
- FFmpeg `avfoundation` is screen-based, so crop mode can include windows covering WeChat. The fallback `screencapture -l` path is window-based and is closer to Tencent Meeting style app-window sharing.
|
|
- `-input` is the FFmpeg `avfoundation` screen device. List devices with:
|
|
|
|
```bash
|
|
ffmpeg -hide_banner -f avfoundation -list_devices true -i ""
|
|
```
|