A comprehensive test suite for validating FFmpeg's OpenColorIO (OCIO) filter implementation against the reference oiiotool implementation.
This test suite compares FFmpeg's ocio video filter output against oiiotool (from OpenImageIO) to ensure color transformations are accurate. It uses PSNR (Peak Signal-to-Noise Ratio) analysis to validate that FFmpeg produces results matching the reference implementation.
- Colorspace Transformations: Tests color space conversions (e.g., ACEScg → ACEScct)
- Display/View Transforms: Validates display and view transformations with ACES configs
- Inverse Transforms: Tests inverse display transformations
- Context Parameters: Verifies OCIO context parameter handling
- File Transforms: Tests LUT-based file transformations
- Format Support: Validates multiple pixel formats (8-bit, 10-bit, 12-bit, 16-bit, float)
- YUV Conversion: Tests RGB to YUV444 conversions with OCIO transforms
- Comprehensive Logging: Generates detailed logs for each test case
- Python 3.x
- pytest
- FFmpeg with OpenColorIO support (custom build)
- oiiotool (from OpenImageIO)
- Test media files in
sourcemedia/directory
- Clone the repository:
git clone <repository-url>
cd ffmpeg-ocio-test- Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate # On macOS/Linux- Install dependencies:
pip install pytest- Update the FFmpeg binary path in
ociotest.py:
FFMPEG_BIN = "/path/to/your/ffmpeg-with-ocio"pytest ociotest.py -v# Colorspace conversion tests
pytest ociotest.py::test_ocio_colorspace_vs_oiiotool -v
# Display/view transform tests
pytest ociotest.py::test_ocio_vs_oiiotool -v
# Inverse transform tests
pytest ociotest.py::test_ocio_invert_vs_oiiotool -v
# Generic argument tests (including context params and file transforms)
pytest ociotest.py::test_ocio_args_vs_oiiotool -v
# YUV conversion tests
pytest ociotest.py::test_ocio_vs_oiiotool_2_yuv444 -vpytest ociotest.py::test_ocio_vs_oiiotool[exr16rgb24] -vThe test suite automatically generates a PSNR summary table at the end of the test run, showing:
- Test name
- Output file
- Calculated PSNR
- Minimum required PSNR
- Pass/fail status
-
test_ocio_colorspace_vs_oiiotool: Colorspace-to-colorspace conversions- Tests various input formats (EXR, DPX, PNG)
- Validates different bit depths (8, 10, 12, 16, 32-bit)
- Compares FFmpeg's
input/outputparameters against oiiotool's--colorconvert
-
test_ocio_vs_oiiotool: Display and view transformations- Tests ACES display transforms
- Validates sRGB display output
- Compares FFmpeg's
display/viewparameters against oiiotool's--ociodisplay
-
test_ocio_invert_vs_oiiotool: Inverse display transformations- Tests inverse display transforms
- Validates the
inverse=1parameter
-
test_ocio_args_vs_oiiotool: Generic OCIO operations- Tests OCIO context parameters
- Tests file-based transforms (LUTs)
- Flexible parameter testing
-
test_ocio_vs_oiiotool_2_yuv444: YUV conversion pipeline- Tests OCIO transform + RGB to YUV conversion
- Validates various YUV formats (yuv444p10, yuv444p12)
- Tests video encoding with color metadata
- Test outputs:
./output/directory- Generated images from both FFmpeg and oiiotool
- Detailed log files for each test case
- PSNR comparison results
The sourcemedia/ directory contains:
- Test images: EXR, DPX, PNG files at various bit depths
- OCIO configs: ACES studio config and simple test configs
- LUT files: Sample .spi1d files for file transform tests
Tests use different PSNR thresholds based on bit depth and conversion complexity:
- 100.0 dB: Lossless conversions (16-bit, 32-bit float)
- 95.0 dB: High-quality conversions (10-bit, 12-bit)
- 82.0 dB: YUV conversions (accounts for chroma subsampling)
- 52.0 dB: 8-bit conversions (lower precision)
Update FFMPEG_BIN in ociotest.py:
FFMPEG_BIN = "/Users/sam/roots/ffmpeg-ocio-8.0/bin/ffmpeg"Add new test cases by extending the @pytest.mark.parametrize decorators with additional parameter sets.
-
Check that FFmpeg has OCIO support:
ffmpeg -filters | grep ocio -
Verify oiiotool is installed:
which oiiotool
-
Check log files in
./output/for detailed error messages
Ensure all required test media files are present in sourcemedia/. The test will fail with "File not found" errors if media is missing.
See LICENSE file for details.
This test suite was created as a separate project because it requires external dependencies (oiiotool) and large media files that are not suitable for FFmpeg's FATE (FFmpeg Automated Testing Environment) test suite. A minimal subset of these tests may be adapted for FATE in the future.