Add browser session recording to GIF/MP4
Context
WaveXisMCP has wavexis_record (records interactions as YAML) and wavexis_video_record (records video as WebM). But there's no easy way to create a GIF or MP4 from a recorded session that's suitable for:
- README demos
- Bug reports with visual reproduction
- Documentation GIFs
- Social media sharing
What needs to happen
New tool wavexis_session_to_gif (or wavexis_record_to_gif) that:
- Takes a recorded session (either live or from YAML)
- Captures screenshots at each step (navigate, click, type, etc.)
- Combines them into an animated GIF or MP4
Options
format: "gif" | "mp4" (default: "gif")
fps: frames per second (default: 2 for GIF, 10 for MP4)
output_path: where to save the file
highlight_clicks: draw a red circle at click coordinates (default: true)
highlight_types: draw a box around typed text (default: true)
wait_after_action: seconds to wait after each action before capturing (default: 0.5)
Implementation
Option A: Screenshot-based (simpler, no external deps)
- During session recording, capture a screenshot after each action
- Use Pillow (
PIL.Image) to combine screenshots into a GIF
- For MP4, use
imageio or opencv-python
Option B: Video-based (better quality)
- Use the existing
wavexis_video_record to capture WebM
- Convert to GIF using
ffmpeg or moviepy
- Higher quality but requires ffmpeg as a dependency
Recommendation: Start with Option A (screenshot-based) — no external deps beyond Pillow which is already common.
Example
# Record a session
wavexis_session_open(backend="cdp")
sid = "abc-123"
wavexis_navigate(session_id=sid, url="https://example.com")
wavexis_click(session_id=sid, selector="#login")
wavexis_type(session_id=sid, selector="#username", text="admin@example.com")
wavexis_click(session_id=sid, selector="#submit")
# Convert to GIF
wavexis_session_to_gif(session_id=sid, output_path="demo.gif", fps=2)
-> {"gif_path": "demo.gif", "frames": 4, "duration_seconds": 2.0}
Getting started
- Read
wavexis_mcp/tools/data.py to see how wavexis_record works
- Read
wavexis_mcp/tools/video.py to see how video recording works
- Implement the screenshot-based approach first
- Add
Pillow to the data optional dependency group in pyproject.toml
- Add tests
- Update
docs/tools/data.md
References
Add browser session recording to GIF/MP4
Context
WaveXisMCP has
wavexis_record(records interactions as YAML) andwavexis_video_record(records video as WebM). But there's no easy way to create a GIF or MP4 from a recorded session that's suitable for:What needs to happen
New tool
wavexis_session_to_gif(orwavexis_record_to_gif) that:Options
format:"gif"|"mp4"(default:"gif")fps: frames per second (default: 2 for GIF, 10 for MP4)output_path: where to save the filehighlight_clicks: draw a red circle at click coordinates (default: true)highlight_types: draw a box around typed text (default: true)wait_after_action: seconds to wait after each action before capturing (default: 0.5)Implementation
Option A: Screenshot-based (simpler, no external deps)
PIL.Image) to combine screenshots into a GIFimageiooropencv-pythonOption B: Video-based (better quality)
wavexis_video_recordto capture WebMffmpegormoviepyRecommendation: Start with Option A (screenshot-based) — no external deps beyond Pillow which is already common.
Example
Getting started
wavexis_mcp/tools/data.pyto see howwavexis_recordworkswavexis_mcp/tools/video.pyto see how video recording worksPillowto thedataoptional dependency group inpyproject.tomldocs/tools/data.mdReferences