# How Parallel Sub-Agents Render Multiple Video Animations Simultaneously in video-use

> Learn how parallel sub-agents in browser-use/video-use render multiple video animations simultaneously. Discover efficient animation processing and compositing techniques for your projects.

- Repository: [Browser Use/video-use](https://github.com/browser-use/video-use)
- Tags: architecture
- Published: 2026-07-05

---

**Parallel sub-agents in `browser-use/video-use` render multiple video animations simultaneously by isolating each animation in its own slot directory and running independent engine processes that the main script composites into the final output.**

The `browser-use/video-use` repository treats every animation as an independent slot that can be rendered concurrently by dedicated sub-agents. By delegating each render to its own process and filesystem path, the system eliminates race conditions and keeps total wall-clock time roughly equal to the slowest single animation. Understanding how parallel sub-agents render multiple video animations simultaneously is essential for scaling video projects that contain many dynamic overlays.

## Slot Directory Layout Guarantees Isolated Renders

The pipeline enforces isolation through a strict directory convention defined in [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md). Every **parallel sub-agent** receives a unique `<edit>/animations/slot_<id>/` directory where it writes its output.

Because the sub-agents share no context and each slot uses a distinct path, no two processes can overwrite the same file. This slot-based structure is the foundation that lets parallel sub-agents render multiple video animations simultaneously without locks or synchronization primitives. The final deliverable from each slot is typically named `render.mp4` or `render.webm`, though the exact filename is dictated by the absolute path in the sub-agent brief.

## Spawning Concurrent Sub-Agents with Isolated Briefs

The parent LLM launches an **`Agent`** tool instance for each slot, supplying a *parallel-sub-agent brief* that specifies the animation goal, output path, engine, and resolution. Because each `Agent` runs in its own process, all slots execute concurrently.

### Bash Parallel Spawn

The following pattern creates two slots and launches two sub-agents in the background, then blocks until both finish:

```bash

# create slots

mkdir -p edit/animations/slot_1 edit/animations/slot_2

# spawn the first sub-agent (HyperFrames example)

Agent <<'EOF' &
You are a sub-agent. Build ONE animation:
- Goal: "Show product UI onboarding"
- Output: $(pwd)/edit/animations/slot_1/render.mp4
- Engine: HyperFrames
- Resolution: 1920x1080, 30 fps, CRF 18
EOF

# spawn the second sub-agent (Manim example)

Agent <<'EOF' &
You are a sub-agent. Build ONE animation:
- Goal: "Explain algorithm with a graph"
- Output: $(pwd)/edit/animations/slot_2/render.mp4
- Engine: Manim
- Resolution: 1080p, 24 fps
EOF

# wait for both agents to finish

wait

```

### Python Process Wrapper

You can achieve the same concurrency in Python by wrapping each brief in a `subprocess.Popen` call:

```python
import subprocess
from pathlib import Path

def launch_subagent(slot_id: int, brief: str) -> subprocess.Popen:
    """Run the Agent tool with a brief for a single animation slot."""
    proc = subprocess.Popen(
        ["Agent"],                # the Agent CLI provided by the LLM runtime

        stdin=subprocess.PIPE,
        text=True,
    )
    proc.communicate(brief)
    return proc

# Slot 1 – HyperFrames

brief1 = f"""
You are a sub-agent. Build ONE animation:
- Goal: "Show product UI onboarding"
- Output: {Path.cwd()}/edit/animations/slot_1/render.mp4
- Engine: HyperFrames
- Resolution: 1920x1080, 30 fps, CRF 18
"""
p1 = launch_subagent(1, brief1)

# Slot 2 – Manim

brief2 = f"""
You are a sub-agent. Build ONE animation:
- Goal: "Explain algorithm with a graph"
- Output: {Path.cwd()}/edit/animations/slot_2/render.mp4
- Engine: Manim
- Resolution: 1080p, 24 fps
"""
p2 = launch_subagent(2, brief2)

# Wait for both sub-agents (they run in parallel)

subprocess.wait([p1.pid, p2.pid])

```

## Engine Flexibility Inside Each Slot

Each sub-agent is free to choose the engine best suited for its brief. The `video-use` pipeline supports **HyperFrames**, **Remotion**, **Manim**, and **PIL**. When parallel sub-agents render multiple video animations simultaneously, one slot might use Manim for algorithmic diagrams while another uses HyperFrames for UI screen recordings. The parent workflow imposes no ordering restrictions, so the total wall-clock duration is dictated by the slowest engine render rather than the sum of all renders.

## Compositing Overlays in helpers/render.py

After all sub-agents finish, the main video assembly step occurs in [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py). The script reads the **overlays** list from the **EDL**, applies per-segment grading, and composites each overlay onto the timeline using an FFmpeg `setpts` filter.

According to the implementation in [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py) (lines 382–388), the compositor shifts each overlay’s timeline so its first frame aligns with its target window in the final output:

```python

# after extracting and grading each source segment …

for overlay in edl["overlays"]:
    # overlay["file"] is the absolute path written by a sub-agent

    overlay_path = Path(overlay["file"])
    start_in_output = overlay["start_in_output"]
    # shift the overlay's timeline so the first frame aligns with its window

    filter_str = f"[{overlay_path}:v]setpts=PTS-STARTPTS+{start_in_output}/TB[ov{idx}];"
    filter_chain.append(filter_str)

# finally, concatenate all streams and burn subtitles (hard rule 1)

```

This final stage follows hard rule 4 for timeline alignment and hard rule 1 for final concatenation and subtitle burning. Because every `overlay["file"]` points to an absolute path produced by a distinct sub-agent, the compositor can safely pull in all renders without encountering write collisions.

## Summary

- `browser-use/video-use` assigns every animation to a unique `<edit>/animations/slot_<id>/` directory, ensuring filesystem isolation.
- The parent LLM spawns an independent `Agent` process for each slot, allowing parallel sub-agents to render multiple video animations simultaneously.
- Supported engines include **HyperFrames**, **Remotion**, **Manim**, and **PIL**, and each sub-agent selects the engine in its own brief.
- Wall-clock time is roughly equal to the slowest individual render because all slots run concurrently.
- The main [`render.py`](https://github.com/browser-use/video-use/blob/main/render.py) script composites finished overlays by reading absolute paths from the EDL and applying an FFmpeg `setpts=PTS-STARTPTS+{start_in_output}/TB` filter.

## Frequently Asked Questions

### How does slot-based isolation work in video-use?

Each sub-agent writes its output to a dedicated `<edit>/animations/slot_<id>/` directory defined in [`SKILL.md`](https://github.com/browser-use/video-use/blob/main/SKILL.md). Because paths are unique and agents share no context, they cannot overwrite each other’s files. This design removes the need for locks or mutexes during parallel execution.

### Can sub-agents overwrite each other’s output files?

No. The parallel sub-agent architecture guarantees safe execution by giving every render its own slot directory and absolute output path. Race conditions are impossible because no two sub-agents target the same filesystem location.

### Which rendering engines can a sub-agent use?

A sub-agent may select **HyperFrames**, **Remotion**, **Manim**, or **PIL** depending on the animation requirements. The engine choice is declared inside the sub-agent brief, and each slot runs its chosen engine independently of the others.

### How does the final video composite all overlays?

The main [`render.py`](https://github.com/browser-use/video-use/blob/main/render.py) script reads the `overlays` entries from the EDL and maps each `overlay["file"]` to its timeline position using `start_in_output`. It then generates an FFmpeg filter chain with `setpts=PTS-STARTPTS+{start_in_output}/TB` to align every overlay correctly before concatenating streams and burning subtitles.