# How to Generate HDR Video Output with EXR Export Using LTX-2 HDR IC-LoRA

> Generate HDR video output by exporting EXR tensors with the LTX-2 HDR IC-LoRA pipeline. Learn how to manually save your HDR tensor for advanced video workflows.

- Repository: [Lightricks/LTX-2](https://github.com/Lightricks/LTX-2)
- Tags: how-to-guide
- Published: 2026-06-20

---

**The LTX-2 HDR IC-LoRA pipeline outputs a linear floating-point HDR tensor that requires manual export using `save_exr_tensor`, as the pipeline performs no automatic tonemapping or file writing.**

LTX-2 provides a specialized **HDR IC-LoRA** workflow for creating high-dynamic-range video content through the `HDRICLoraPipeline` class. Unlike standard generation pipelines, this implementation returns raw linear HDR values that must be saved to disk using specific utility functions. This guide covers the complete workflow from model instantiation to EXR sequence export using the Lightricks/LTX-2 source code.

## Required Assets and Checkpoints

Before instantiating the pipeline, gather four specific checkpoint files. The pipeline constructor at [`packages/ltx-pipelines/src/ltx_pipelines/hdr_ic_lora.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/hdr_ic_lora.py) (lines 84‑89) expects these components:

- **Distilled checkpoint** – The base LTX-2 model weights (e.g., `ltx-2.3-22b-distilled.safetensors`)
- **Spatial upsampler** – The 2× refinement model (`ltx-2.3-spatial-upscaler-x2-1.0.safetensors`)
- **HDR LoRA weights** – A `.safetensors` file containing the HDR-specific LoRA parameters
- **Text embeddings** – Pre-computed video and audio context tensors stored as a `.safetensors` file

## Instantiating the HDR IC-LoRA Pipeline

Import the pipeline class and initialize it with your checkpoint paths. The constructor automatically loads the text embeddings and parses the HDR LoRA metadata, logging the active HDR transform (defaults to `logc3`).

```python
from ltx_pipelines.hdr_ic_lora import HDRICLoraPipeline

pipeline = HDRICLoraPipeline(
    distilled_checkpoint_path="ltx-2.3-22b-distilled.safetensors",
    spatial_upsampler_path="ltx-2.3-spatial-upscaler-x2-1.0.safetensors",
    hdr_lora="hdr_lora.safetensors",
    text_embeddings_path="scene_embeddings.safetensors",
)

```

## Running Inference to Generate HDR Tensors

Call the pipeline with your target resolution, frame count, and conditioning video. According to the implementation at lines 311‑319 of [`hdr_ic_lora.py`](https://github.com/Lightricks/LTX-2/blob/main/hdr_ic_lora.py), the return value is a **linear HDR tensor** with shape `[f, h, w, c]` (frames, height, width, channels).

```python
hdr_tensor = pipeline(
    seed=42,
    height=1080,
    width=1920,
    num_frames=120,
    frame_rate=30.0,
    video_conditioning=[("conditioning_video.mp4", 1.0)],  # IC-LoRA conditioning

)

```

The output `hdr_tensor` is a `torch.Tensor` containing floating-point linear HDR values. No tonemapping is applied at this stage.

## Exporting EXR Frames

Use the `save_exr_tensor` utility located in [`packages/ltx-pipelines/src/ltx_pipelines/utils/media_io.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/media_io.py) (lines 705‑728) to write each frame to an EXR file. This function uses OpenImageIO to store floating-point data with sRGB chromaticities and supports both float32 (default) and float16 output.

```python
from pathlib import Path
from ltx_pipelines.utils.media_io import save_exr_tensor

out_dir = Path("exr_frames")
out_dir.mkdir(parents=True, exist_ok=True)

for i, frame in enumerate(hdr_tensor):
    save_exr_tensor(
        tensor=frame,
        file_path=out_dir / f"frame_{i:05d}.exr",
        half=False  # Set True for float16-ZIP compression

    )

```

The EXR files are written losslessly with proper color space attributes, making them suitable for compositing in Nuke, DaVinci Resolve, or other HDR workflows.

## Creating SDR Preview Videos

After exporting the EXR sequence, generate an SDR preview MP4 using `encode_exr_sequence_to_mp4` from the same [`media_io.py`](https://github.com/Lightricks/LTX-2/blob/main/media_io.py) module (lines 746‑784). This utility applies the IEC 61966-2-1 OETF (linear-to-sRGB conversion), converts to 8-bit BGR, and encodes with libx264.

```python
from ltx_pipelines.utils.media_io import encode_exr_sequence_to_mp4

encode_exr_sequence_to_mp4(
    exr_dir=out_dir,
    output_mp4=Path("preview.mp4"),
    frame_rate=30.0,
)

```

## Complete Workflow Example

Below is a complete script that ties together pipeline initialization, inference, EXR export, and optional preview generation:

```python
#!/usr/bin/env python3
import argparse
from pathlib import Path
from ltx_pipelines.hdr_ic_lora import HDRICLoraPipeline
from ltx_pipelines.utils.media_io import save_exr_tensor, encode_exr_sequence_to_mp4

def main():
    parser = argparse.ArgumentParser(description="HDR IC-LoRA generation with EXR export")
    parser.add_argument("--distilled", required=True)
    parser.add_argument("--upsampler", required=True)
    parser.add_argument("--hdr-lora", required=True)
    parser.add_argument("--embeddings", required=True)
    parser.add_argument("--cond-video", required=True)
    parser.add_argument("--out-dir", default="hdr_output")
    parser.add_argument("--height", type=int, default=1080)
    parser.add_argument("--width", type=int, default=1920)
    parser.add_argument("--frames", type=int, default=120)
    parser.add_argument("--fps", type=float, default=30.0)
    parser.add_argument("--skip-mp4", action="store_true")
    parser.add_argument("--exr-half", action="store_true")
    args = parser.parse_args()

    # Initialize pipeline

    pipeline = HDRICLoraPipeline(
        distilled_checkpoint_path=args.distilled,
        spatial_upsampler_path=args.upsampler,
        hdr_lora=args.hdr_lora,
        text_embeddings_path=args.embeddings,
    )

    # Generate HDR tensor [f, h, w, c]

    hdr_tensor = pipeline(
        seed=123,
        height=args.height,
        width=args.width,
        num_frames=args.frames,
        frame_rate=args.fps,
        video_conditioning=[(args.cond_video, 1.0)],
    )

    # Export EXR sequence

    out_dir = Path(args.out_dir)
    out_dir.mkdir(parents=True, exist_ok=True)
    
    for i, frame in enumerate(hdr_tensor):
        save_exr_tensor(
            tensor=frame,
            file_path=out_dir / f"frame_{i:05d}.exr",
            half=args.exr_half
        )

    # Optional SDR preview

    if not args.skip_mp4:
        encode_exr_sequence_to_mp4(
            exr_dir=out_dir,
            output_mp4=out_dir.with_suffix(".mp4"),
            frame_rate=args.fps,
        )

if __name__ == "__main__":
    main()

```

Execute the script from the command line:

```bash
python hdr_exr_export.py \
    --distilled ltx-2.3-22b-distilled.safetensors \
    --upsampler ltx-2.3-spatial-upscaler-x2-1.0.safetensors \
    --hdr-lora hdr_lora.safetensors \
    --embeddings scene_embeddings.safetensors \
    --cond-video input.mp4 \
    --out-dir exr_sequence \
    --height 1080 \
    --width 1920 \
    --frames 120 \
    --fps 30

```

## Summary

- **HDRICLoraPipeline** in [`packages/ltx-pipelines/src/ltx_pipelines/hdr_ic_lora.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/hdr_ic_lora.py) generates linear floating-point HDR tensors without built-in export functionality.
- The pipeline requires four specific checkpoints: distilled base model, spatial upsampler, HDR LoRA weights, and pre-computed text embeddings.
- **save_exr_tensor** (`media_io.py:705‑728`) writes individual frames to EXR format with sRGB chromaticities and optional float16 compression.
- **encode_exr_sequence_to_mp4** (`media_io.py:746‑784`) creates SDR previews by applying linear-to-sRGB transformation and H.264 encoding.
- The output EXR sequence contains lossless linear HDR values suitable for professional compositing workflows.

## Frequently Asked Questions

### Does the HDRICLoraPipeline automatically save video files?

No. The pipeline returns a raw `torch.Tensor` object in `[f, h, w, c]` format containing linear HDR values. You must explicitly export frames using `save_exr_tensor` or another I/O utility, as the pipeline does not perform file writing or tonemapping operations.

### What is the difference between `--exr-half` and default EXR export?

When `half=False` (default), `save_exr_tensor` writes 32-bit floating-point EXR files with full precision. Setting `half=True` enables 16-bit float (half-float) output with ZIP compression, reducing file size by approximately 50% while maintaining sufficient precision for most HDR workflows.

### Why does the pipeline require pre-computed text embeddings?

The `HDRICLoraPipeline` constructor loads text embeddings from a `.safetensors` file rather than computing them on-the-fly. This design decouples the expensive text encoding process from the diffusion inference, allowing faster iteration when adjusting video generation parameters.

### Can I use the HDR LoRA with standard LTX-2 pipelines?

No. HDR generation requires the specific `HDRICLoraPipeline` class, which handles HDR-specific metadata (such as the `logc3` transform) and manages the interaction between the distilled checkpoint, spatial upsampler, and HDR LoRA weights. Standard pipelines lack the conditioning logic for high-dynamic-range output.