1.3 KiB
1.3 KiB
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:
cd demos/go-ffmpeg-wechat-stream
go run .
Open:
http://127.0.0.1:8765/
Options:
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=falseto fail immediately. - FFmpeg
avfoundationis screen-based, so crop mode can include windows covering WeChat. The fallbackscreencapture -lpath is window-based and is closer to Tencent Meeting style app-window sharing. -inputis the FFmpegavfoundationscreen device. List devices with:
ffmpeg -hide_banner -f avfoundation -list_devices true -i ""