Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/docker-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: "Docker Integration Tests"

on:
pull_request:
push:
branches:
- main

jobs:
docker-integration-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build runtime image
uses: docker/build-push-action@v5
with:
context: .
target: runtime
tags: aiperf:test
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build env-builder stage (for uv)
uses: docker/build-push-action@v5
with:
context: .
target: env-builder
tags: aiperf:env-builder
load: true
cache-from: type=gha

- name: Copy uv from env-builder to host
run: |
docker create --name uv-container aiperf:env-builder
docker cp uv-container:/bin/uv ./uv
docker rm uv-container
chmod +x ./uv

- name: Fix workspace permissions for container user
run: |
# Make workspace writable by container user (UID 1000)
sudo chown -R 1000:1000 ${{ github.workspace }}

- name: Run integration tests in container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-v ${{ github.workspace }}/uv:/usr/local/bin/uv:ro \
-w /workspace \
aiperf:test \
"uv pip install pytest pytest-xdist pytest-asyncio pytest-cov && \
uv pip install -e 'tests/aiperf_mock_server[dev]' && \
/opt/aiperf/venv/bin/pytest tests/integration/ -m 'integration and not performance and not stress' -n auto -v --tb=long"
67 changes: 66 additions & 1 deletion ATTRIBUTIONS-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This document provides attribution information for third-party software componen
- **Website**: https://ffmpeg.org/
- **License**: LGPL v2.1+
- **Usage**: Video and audio processing library (included in runtime container)
- **Build Configuration**: Built without GPL components (`--disable-gpl --disable-nonfree`)
- **Build Configuration**: Built without GPL components (`--disable-gpl --disable-nonfree --enable-libvpx`)

**License Text:**

Expand Down Expand Up @@ -48,6 +48,65 @@ The FFmpeg source code used to build this container is available at:
- Build configuration excludes GPL-licensed components
- Apache 2.0 licensed code in this project remains separate from LGPL components

### libvpx

**Component Information:**
- **Software**: libvpx (VP8/VP9 Codec SDK)
- **Version**: 1.12.0 (from Debian Bookworm)
- **Source**: Debian Bookworm
- **Website**: https://www.webmproject.org/
- **License**: BSD 3-Clause
- **Usage**: VP9 video codec library (included in runtime container, used by FFmpeg)

**License Text:**

> Copyright (c) 2010, The WebM Project authors. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are
> met:
>
> * Redistributions of source code must retain the above copyright
> notice, this list of conditions and the following disclaimer.
>
> * Redistributions in binary form must reproduce the above copyright
> notice, this list of conditions and the following disclaimer in
> the documentation and/or other materials provided with the
> distribution.
>
> * Neither the name of Google, nor the WebM Project, nor the names
> of its contributors may be used to endorse or promote products
> derived from this software without specific prior written
> permission.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> Full license text: https://chromium.googlesource.com/webm/libvpx/+/refs/heads/main/LICENSE

**Source Code Availability:**

The libvpx source code is available at:
- Debian package: https://packages.debian.org/bookworm/libvpx-dev
- Debian source package: `apt-get source libvpx` from Debian Bookworm repositories
- Upstream WebM Project source: https://chromium.googlesource.com/webm/libvpx/

**Compliance Notes:**

- libvpx binary is copied from Debian Bookworm base image
- No modifications were made to libvpx source code
- libvpx is dynamically linked with FFmpeg
- BSD license is compatible with Apache 2.0

### Bash

**Component Information:**
Expand Down Expand Up @@ -97,6 +156,12 @@ LGPL is compatible with Apache 2.0 when:
- No modifications were made to FFmpeg source code
- Proper attribution is provided (as above)

### libvpx (BSD 3-Clause)
BSD 3-Clause is compatible with Apache 2.0:
- BSD is a permissive license that allows redistribution with minimal restrictions
- Attribution requirements are satisfied through this document
- No conflict with Apache 2.0 terms

### Bash (GPL v3+)
GPL is compatible with Apache 2.0 when:
- Bash runs as a separate executable and is not linked with Apache 2.0 code
Expand Down
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,18 @@ FROM base AS env-builder

WORKDIR /workspace

# Build ffmpeg from source
# Build ffmpeg from source with libvpx
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
nasm \
pkg-config \
wget \
yasm \
libvpx-dev \
&& rm -rf /var/lib/apt/lists/*

# Download and build ffmpeg
# Download and build ffmpeg with libvpx (VP9 codec)
RUN wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz \
&& tar -xf ffmpeg-7.1.tar.xz \
&& cd ffmpeg-7.1 \
Expand All @@ -102,6 +103,7 @@ RUN wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz \
--disable-nonfree \
--enable-shared \
--disable-static \
--enable-libvpx \
--disable-doc \
--disable-htmlpages \
--disable-manpages \
Expand Down Expand Up @@ -137,6 +139,9 @@ COPY LICENSE ATTRIBUTIONS*.md /legal/
# Copy bash with executable permissions preserved using --chmod
COPY --from=env-builder --chown=1000:1000 --chmod=755 /bin/bash /bin/bash

# Copy libvpx libraries
COPY --from=env-builder --chown=1000:1000 /usr/lib/x86_64-linux-gnu/libvpx.so* /usr/lib/x86_64-linux-gnu/

# Copy ffmpeg binaries and libraries
COPY --from=env-builder --chown=1000:1000 /opt/ffmpeg /opt/ffmpeg
ENV PATH="/opt/ffmpeg/bin:${PATH}" \
Expand All @@ -154,4 +159,4 @@ ENV VIRTUAL_ENV=/opt/aiperf/venv \
PATH="/opt/aiperf/venv/bin:${PATH}"

# Set bash as entrypoint
ENTRYPOINT ["/bin/bash", "-c"]
ENTRYPOINT ["/bin/bash", "-c"]
32 changes: 25 additions & 7 deletions docs/tutorials/synthetic-video.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The synthetic video feature provides:
- Configurable resolution, frame rate, and duration
- Hardware-accelerated encoding options (CPU and GPU codecs)
- Base64-encoded video output for API requests
- MP4 format support
- MP4 and WebM format support

## Basic Usage

Expand Down Expand Up @@ -160,13 +160,16 @@ aiperf profile \
--url localhost:8000 \
--video-width 640 \
--video-height 480 \
--video-codec libx264 \
--video-codec libvpx-vp9 \
--video-format webm \
--request-count 20
```

**Available CPU Codecs:**
- `libx264`: H.264 encoding, widely compatible (default)
- `libx265`: H.265 encoding, smaller file sizes, slower encoding
- `libvpx-vp9`: VP9 encoding, BSD-licensed (default, WebM format)
- `libopenh264`: H.264 encoding, BSD-licensed (MP4 format)
- `libx264`: H.264 encoding, GPL-licensed, widely compatible (MP4 format)
- `libx265`: H.265 encoding, GPL-licensed, smaller file sizes, slower encoding (MP4 format)

#### GPU Encoding (NVIDIA)

Expand Down Expand Up @@ -290,8 +293,22 @@ aiperf profile \

### Video Format

Currently, AIPerf supports **MP4** format:
AIPerf supports both **WebM** (default) and **MP4** formats:

**WebM format (default):**
```bash
aiperf profile \
--model your-model-name \
--endpoint-type chat \
--url localhost:8000 \
--video-width 640 \
--video-height 480 \
--video-format webm \
--video-codec libvpx-vp9 \
--request-count 20
```

**MP4 format:**
```bash
aiperf profile \
--model your-model-name \
Expand All @@ -300,6 +317,7 @@ aiperf profile \
--video-width 640 \
--video-height 480 \
--video-format mp4 \
--video-codec libx264 \
--request-count 20
```

Expand All @@ -316,7 +334,7 @@ This allows seamless integration with vision-language model APIs that accept bas

### Encoding Performance

- **CPU codecs** (`libx264`, `libx265`): Slower but universally available
- **CPU codecs** (`libvpx-vp9`, `libopenh264`, `libx264`, `libx265`): Slower but universally available
- **GPU codecs** (`h264_nvenc`, `hevc_nvenc`): Much faster, requires NVIDIA GPU
- Higher resolution and frame rates increase encoding time

Expand Down Expand Up @@ -359,7 +377,7 @@ Error: Encoder 'h264_nvenc' not found
Solutions:
1. Verify NVIDIA GPU is available: `nvidia-smi`
2. Check FFmpeg was compiled with NVENC support: `ffmpeg -encoders | grep nvenc`
3. Fall back to CPU codec: `--video-codec libx264`
3. Fall back to CPU codec: `--video-codec libvpx-vp9 --video-format webm` or `--video-codec libx264 --video-format mp4`

### Out of Memory

Expand Down
4 changes: 2 additions & 2 deletions src/aiperf/common/config/config_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class VideoDefaults:
WIDTH = None
HEIGHT = None
SYNTH_TYPE = VideoSynthType.MOVING_SHAPES
FORMAT = VideoFormat.MP4
CODEC = "libx264"
FORMAT = VideoFormat.WEBM
CODEC = "libvpx-vp9"


@dataclass(frozen=True)
Expand Down
4 changes: 3 additions & 1 deletion src/aiperf/common/config/video_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def validate_width_and_height(self) -> Self:
Field(
description=(
"The video codec to use for encoding. Common options: "
"libx264 (CPU, widely compatible), libx265 (CPU, smaller files), "
"libvpx-vp9 (CPU, BSD-licensed, default for WebM), "
"libopenh264 (CPU, BSD-licensed), libx264 (CPU, GPL-licensed, widely compatible), "
"libx265 (CPU, GPL-licensed, smaller files), "
"h264_nvenc (NVIDIA GPU), hevc_nvenc (NVIDIA GPU, smaller files). "
"Any FFmpeg-supported codec can be used."
),
Expand Down
1 change: 1 addition & 0 deletions src/aiperf/common/enums/dataset_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class AudioFormat(CaseInsensitiveStrEnum):

class VideoFormat(CaseInsensitiveStrEnum):
MP4 = "mp4"
WEBM = "webm"


class VideoSynthType(CaseInsensitiveStrEnum):
Expand Down
Loading
Loading