Skip to content

Reproduce the agent-authored edit demo

This demo turns the repository's landscape dog clip into an eight-second vertical cut. It is a deterministic replay of the JSON plan an LLM or MCP agent can author, so it does not need an API key, a model, or the [ai] extra.

Run it

Clone the repository, install FFmpeg, and run:

uv sync
uv run python examples/agent_edit_demo.py

The script reads src/tests/test_data/big_video.mp4 and writes docs/assets/agent-edit-demo.mp4. Pass --source or --output to use different paths.

Give an agent the same brief

Turn the dog clip into a vertical social shot. Use the expressive middle section, increase the color slightly, add a restrained punch-in, and fade at both ends.

The replay uses this plan:

{
  "segments": [
    {
      "source": "src/tests/test_data/big_video.mp4",
      "start": 2.0,
      "end": 10.0,
      "operations": [
        {"op": "crop", "width": 400, "height": 500},
        {"op": "resize", "width": 512, "height": 640},
        {"op": "color_adjust", "contrast": 1.08, "saturation": 1.15},
        {"op": "punch_in", "zoom_factor": 1.04, "attack_frames": 12, "release_frames": 12},
        {"op": "fade", "mode": "in_out", "duration": 0.35}
      ]
    }
  ]
}

VideoEdit.from_dict() parses the same JSON shape exposed to an LLM. The script calls validate() before rendering, then streams the edit to the output file. To let an agent select scenes by catalog id instead of receiving exact time bounds, use the MCP workflow.