# What Are the Main Steps in the Video-Use Rendering Pipeline? A 6-Stage Breakdown

> Understand the video-use rendering pipeline. Explore the 6 main stages from segment extraction to final write-out for social-media ready video.

- Repository: [Browser Use/video-use](https://github.com/browser-use/video-use)
- Tags: internals
- Published: 2026-08-06

---

**The video-use rendering pipeline follows a deterministic, multi-stage process that transforms an Edit Decision List (EDL) into a social-media-ready video through six core phases: per-segment extraction, lossless concatenation, optional master subtitle generation, final compositing, loudness normalization, and final write-out.**

The `video-use` tool—developed by browser-use—implements a reproducible FFmpeg-based pipeline specifically designed for short-form content. According to the source code in [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py), the process follows the "HEURISTICS" order documented in the module header (lines 3-10), ensuring consistent output quality and predictable performance.

---

## Step 1: Per-Segment Extraction

Every rendering job begins with **per-segment extraction**, where each EDL range is cut from its source video and processed individually.

In [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py), the `extract_segment` and `extract_all_segments` functions (lines 61-70 and 148-160) handle this phase. Each segment undergoes:

- Optional **colour grading** using presets from [`helpers/grade.py`](https://github.com/browser-use/video-use/blob/main/helpers/grade.py)
- **Tone mapping** (HDR to SDR conversion) when needed
- **Scaling** to the target orientation and resolution
- **30 ms audio fades** baked into the extracted clip

The extraction logic respects preview and draft modes—automatically selecting faster presets and lower resolutions when speed matters more than final quality.

---

## Step 2: Lossless Concatenation

Once all segments are extracted, the pipeline performs **lossless concatenation** without re-encoding.

The `concat_segments` function (lines 67-83) uses FFmpeg's concat demuxer to join clips into a single "base" MP4. This `-c copy` approach preserves quality and maximizes speed by avoiding unnecessary decoding and re-encoding.

---

## Step 3: Master Subtitle Generation (Optional)

If subtitle generation is requested, the pipeline builds a **master SRT** from per-source transcripts.

The `build_master_srt` function (lines 15-84) performs three operations:

1. **Aligns words** to the output timeline based on EDL cut points
2. **Groups words** into 2-word caption segments for readability
3. **Applies a proven ASS style** for consistent visual presentation

This stage is skipped when `--no-subtitles` is passed or when no transcript data exists.

---

## Step 4: Final Compositing

The **final compositing** stage merges the base video with overlays and subtitles.

In `build_final_composite` (lines 95-70), the pipeline:

- **PTS-shifts overlay clips** so their frame 0 aligns with the specified start time
- Applies animations and graphics as separate input streams
- **Adds subtitles last** in the filter graph, as explicitly mandated by the module docstring

If no overlays or subtitles exist, this stage simply copies the base file—avoiding unnecessary processing.

---

## Step 5: Loudness Normalization

Audio processing occurs through a **two-pass loudnorm filter** targeting social media specifications.

The `apply_loudnorm_two_pass` function (lines 31-90) achieves:

| Parameter | Target Value |
|-----------|--------------|
| Integrated loudness | –14 LUFS |
| True peak | –1 dBTP |
| Loudness range (LRA) | 11 |

In preview or draft mode, the pipeline falls back to a faster one-pass approximation to reduce render time.

---

## Step 6: Final Write-Out

The pipeline concludes with **final write-out**, where the normalized (or directly composited) file is written to the user-specified output path. The `main()` function (lines 73-56) handles this stage and reports the final file size upon completion.

---

## Command Examples

Run a full-quality render with subtitles and loudness normalization:

```bash
python helpers/render.py my_edl.json -o final.mp4 --build-subtitles

```

Generate a quick 1080p preview with faster encoding:

```bash
python helpers/render.py my_edl.json -o preview.mp4 --preview --no-loudnorm

```

Create a minimal draft for cut-point verification:

```bash
python helpers/render.py my_edl.json -o draft.mp4 --draft

```

---

## Key Source Files

| File | Role |
|------|------|
| [`helpers/render.py`](https://github.com/browser-use/video-use/blob/main/helpers/render.py) | Central orchestration of all six pipeline stages |
| [`helpers/grade.py`](https://github.com/browser-use/video-use/blob/main/helpers/grade.py) | Preset lookup and auto-grade algorithm implementation |
| [`helpers/timeline_view.py`](https://github.com/browser-use/video-use/blob/main/helpers/timeline_view.py) | Visual timeline generation for debugging (not part of render pipeline) |
| [`README.md`](https://github.com/browser-use/video-use/blob/main/README.md) | Repository overview and basic usage |
| [`install.md`](https://github.com/browser-use/video-use/blob/main/install.md) | FFmpeg and Python dependency installation instructions |

---

## Summary

- **Per-segment extraction** handles colour grading, tone mapping, scaling, and audio fades for each EDL range
- **Lossless concatenation** joins clips with `-c copy` for speed and quality preservation
- **Master subtitle generation** aligns transcripts, groups words, and applies ASS styling when requested
- **Final compositing** applies overlays with PTS shifting and subtitles last in the filter graph
- **Loudness normalization** uses two-pass processing for –14 LUFS social media compliance
- **Final write-out** delivers the completed file with size reporting

---

## Frequently Asked Questions

### What file format does the video-use pipeline output?

The pipeline outputs standard MP4 files using H.264 video and AAC audio codecs. The final container is compatible with all major social media platforms including Instagram, TikTok, YouTube Shorts, and Twitter/X.

### Can I skip loudness normalization for faster renders?

Yes. Pass `--no-loudnorm` or use `--preview` or `--draft` modes to bypass the two-pass normalization. Preview mode uses a faster one-pass approximation, while draft mode skips normalization entirely.

### How does video-use handle portrait versus landscape orientation?

The per-segment extraction stage scales content to the appropriate orientation based on project settings. The scaling logic respects source aspect ratios while ensuring the output matches the target dimensions specified in the EDL configuration.

### Where are the colour grading presets defined?

Preset definitions and the fallback auto-grade algorithm reside in [`helpers/grade.py`](https://github.com/browser-use/video-use/blob/main/helpers/grade.py). The `get_preset` function retrieves named presets, and automatic grading activates when no preset is explicitly specified for a segment.