From 39fa15c97873223f3aa275872a39c5cf27bafd01 Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Tue, 7 Jul 2026 12:15:03 -0400 Subject: [PATCH 01/10] Added Dockerfile for building, with a checkout for feather-tk back to the version used with the last toucan main version --- Dockerfile | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e74f815 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,67 @@ +# -*- mode: sh -*- +# vi: set ft=bash : + +FROM ubuntu:latest AS builder + +WORKDIR /home/ubuntu + +RUN apt-get update && apt-get install -y build-essential \ + cmake \ + g++ \ + git \ + minizip \ + libminizip-ng-dev \ + xorg-dev \ + libglu1-mesa-dev \ + mesa-common-dev \ + mesa-utils \ + curl \ + pipx \ + libjpeg-dev \ + libtiff-dev \ + libpng++-dev \ + libimath-dev \ + libopencv-dev \ + ffmpeg \ + libyaml-cpp-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + openimageio-tools \ + libopenexr-dev \ + libopenimageio-dev \ + libopencolorio-dev \ + libopentimelineio-dev + +# Clone, compile and install feather-tk library +RUN mkdir feather-tk +RUN cd feather-tk; git clone https://github.com/grizzlypeak3d/feather-tk.git +# We revert feather-tk to the last date matching version to the current toucan main branch date. +# This is only needed until the toucan codebase and feather-tk library are synchronised in their APIs. +RUN cd feather-tk; git checkout 3cee68ec +RUN cd feather-tk; sh feather-tk/sbuild-linux.sh feather-tk +# TODO replace with cmake --target install +RUN tar -C feather-tk/install-Release -c -f - . | tar -C /usr/local -x -f - + +# Add the pipx installation location: +ENV PATH=/root/.local/share/pipx/venvs/conan/bin:$PATH + +# We need conan for openFX building. +RUN pipx ensurepath +RUN pipx install conan +RUN conan profile detect + +# TODO Unable to get it because of github blocking automation. +# curl -O https://github.com/AcademySoftwareFoundation/openfx/releases/download/OFX_Release_1.5.1/openfx-linux-ubuntu-1.5.1.tar.gz +RUN git clone https://github.com/AcademySoftwareFoundation/openfx.git +# TODO this doesn't build on arm64 Linux currently, can't find the architecture. +RUN cd openfx; scripts/build-cmake.sh +# TODO need to find a better installation method, cmake --target install +RUN mkdir /usr/local/include/OpenFX +RUN tar -C openfx/include -c -f - . | tar -C /usr/local/include/OpenFX -x -f - + +# RUN git clone https://github.com/OpenTimelineIO/toucan.git +# RUN git clone https://github.com/leighsmith/toucan.git +COPY . /home/ubuntu/toucan + +# RUN sh toucan/sbuild-linux.sh From 24275c5b521003988986b54d39bcc44c9bd8f36e Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Tue, 7 Jul 2026 14:08:40 -0400 Subject: [PATCH 02/10] Updated for install locations on older versions of feather-tk --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e74f815..47cd525 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,10 +38,10 @@ RUN mkdir feather-tk RUN cd feather-tk; git clone https://github.com/grizzlypeak3d/feather-tk.git # We revert feather-tk to the last date matching version to the current toucan main branch date. # This is only needed until the toucan codebase and feather-tk library are synchronised in their APIs. -RUN cd feather-tk; git checkout 3cee68ec +RUN cd feather-tk/feather-tk; git checkout 3cee68ec RUN cd feather-tk; sh feather-tk/sbuild-linux.sh feather-tk # TODO replace with cmake --target install -RUN tar -C feather-tk/install-Release -c -f - . | tar -C /usr/local -x -f - +RUN tar -C feather-tk/install-feather-tk -c -f - . | tar -C /usr/local -x -f - # Add the pipx installation location: ENV PATH=/root/.local/share/pipx/venvs/conan/bin:$PATH From dca759410fc109e2b0af25ab338ec9e184e31dc9 Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Wed, 29 Jul 2026 11:40:37 -0400 Subject: [PATCH 03/10] Added additional dependencies, but also disabled building the example plugins as they don't seem to be able to be found with cmake --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 47cd525..09356b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,9 @@ RUN apt-get update && apt-get install -y build-essential \ minizip \ libminizip-ng-dev \ xorg-dev \ + cimg-dev \ + pkg-config \ + libgl-dev \ libglu1-mesa-dev \ mesa-common-dev \ mesa-utils \ @@ -51,11 +54,13 @@ RUN pipx ensurepath RUN pipx install conan RUN conan profile detect -# TODO Unable to get it because of github blocking automation. +# TODO Unable to get the release because of github blocking automation. # curl -O https://github.com/AcademySoftwareFoundation/openfx/releases/download/OFX_Release_1.5.1/openfx-linux-ubuntu-1.5.1.tar.gz RUN git clone https://github.com/AcademySoftwareFoundation/openfx.git +# Must turn off the plugins building with BUILD_EXAMPLE_PLUGINS=FALSE to avoid issues from cmake being unable to find OpenGL and CImg. +# Also, remove `--target install` from cmake because the generated Makefile doesn't have an install rule, for some reason? # TODO this doesn't build on arm64 Linux currently, can't find the architecture. -RUN cd openfx; scripts/build-cmake.sh +RUN cd openfx; scripts/build-cmake.sh -v Release -DBUILD_EXAMPLE_PLUGINS=FALSE -DPLUGIN_INSTALLDIR=./build/Install # TODO need to find a better installation method, cmake --target install RUN mkdir /usr/local/include/OpenFX RUN tar -C openfx/include -c -f - . | tar -C /usr/local/include/OpenFX -x -f - From f2e049caeaadd9b612465e9684e24e034446efbd Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Mon, 3 Aug 2026 16:14:37 -0400 Subject: [PATCH 04/10] Removed ffmpeg installed libraries, since these were clashing with the Cmake built versions, causing a link problem --- Dockerfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 09356b8..4529153 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,14 +25,8 @@ RUN apt-get update && apt-get install -y build-essential \ libpng++-dev \ libimath-dev \ libopencv-dev \ - ffmpeg \ libyaml-cpp-dev \ - libavcodec-dev \ - libavformat-dev \ - libswscale-dev \ - openimageio-tools \ libopenexr-dev \ - libopenimageio-dev \ libopencolorio-dev \ libopentimelineio-dev @@ -48,6 +42,7 @@ RUN tar -C feather-tk/install-feather-tk -c -f - . | tar -C /usr/local -x -f - # Add the pipx installation location: ENV PATH=/root/.local/share/pipx/venvs/conan/bin:$PATH +# ENV CMAKE_INCLUDE_PATH=/usr/include/minizip-ng # We need conan for openFX building. RUN pipx ensurepath From 59cc436f4a6b3124fbedd6d2255e439745647847 Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Mon, 3 Aug 2026 16:59:20 -0400 Subject: [PATCH 05/10] Added explicit check for FFMPEG modules since they are directly used --- lib/toucanRender/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/toucanRender/CMakeLists.txt b/lib/toucanRender/CMakeLists.txt index 02aa75c..f49a877 100644 --- a/lib/toucanRender/CMakeLists.txt +++ b/lib/toucanRender/CMakeLists.txt @@ -43,6 +43,9 @@ else() PluginUnix.cpp) endif() +find_package(PkgConfig REQUIRED) +pkg_check_modules(FFmpeg REQUIRED IMPORTED_TARGET libavcodec libavformat libavutil libswscale) + add_library(toucanRender ${HEADERS} ${HEADERS_PRIVATE} ${SOURCE}) set(LIBS_PUBLIC toucanResource @@ -51,7 +54,8 @@ set(LIBS_PUBLIC OTIO::opentime lunasvg::lunasvg OpenImageIO::OpenImageIO - MINIZIP::minizip) + MINIZIP::minizip + PkgConfig::FFmpeg) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) list(APPEND LIBS_PUBLIC stdc++fs) endif() From 917096f4bf81a34bbd03d734a079a857fc1e7fe0 Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Wed, 5 Aug 2026 10:43:17 -0400 Subject: [PATCH 06/10] Removed apt installed dependencies which are built by cmake. Pushed version of yaml-cpp to v0.9.0 to get around failure to build v0.7.0 on Linux due to missing includes --- Dockerfile | 4 ---- cmake/SuperBuild/Buildyaml-cpp.cmake | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4529153..3054e0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,6 @@ RUN apt-get update && apt-get install -y build-essential \ cmake \ g++ \ git \ - minizip \ - libminizip-ng-dev \ xorg-dev \ cimg-dev \ pkg-config \ @@ -25,8 +23,6 @@ RUN apt-get update && apt-get install -y build-essential \ libpng++-dev \ libimath-dev \ libopencv-dev \ - libyaml-cpp-dev \ - libopenexr-dev \ libopencolorio-dev \ libopentimelineio-dev diff --git a/cmake/SuperBuild/Buildyaml-cpp.cmake b/cmake/SuperBuild/Buildyaml-cpp.cmake index 718f8b1..7d29a77 100644 --- a/cmake/SuperBuild/Buildyaml-cpp.cmake +++ b/cmake/SuperBuild/Buildyaml-cpp.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(yaml-cpp_GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git") -set(yaml-cpp_GIT_TAG "yaml-cpp-0.7.0") +set(yaml-cpp_GIT_TAG "yaml-cpp-0.9.0") set(yaml-cpp_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} From 614ddacdc9cd210321f342804c2cecc58cb38cdb Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Wed, 5 Aug 2026 15:54:47 +0000 Subject: [PATCH 07/10] Disabled the need to build openfx, it is done by toucan build --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3054e0e..7e07106 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ RUN git clone https://github.com/AcademySoftwareFoundation/openfx.git # Must turn off the plugins building with BUILD_EXAMPLE_PLUGINS=FALSE to avoid issues from cmake being unable to find OpenGL and CImg. # Also, remove `--target install` from cmake because the generated Makefile doesn't have an install rule, for some reason? # TODO this doesn't build on arm64 Linux currently, can't find the architecture. -RUN cd openfx; scripts/build-cmake.sh -v Release -DBUILD_EXAMPLE_PLUGINS=FALSE -DPLUGIN_INSTALLDIR=./build/Install +# RUN cd openfx; scripts/build-cmake.sh -v Release -DBUILD_EXAMPLE_PLUGINS=FALSE -DPLUGIN_INSTALLDIR=./build/Install # TODO need to find a better installation method, cmake --target install RUN mkdir /usr/local/include/OpenFX RUN tar -C openfx/include -c -f - . | tar -C /usr/local/include/OpenFX -x -f - From 6da5f1d206212e21988031d74c38f4610b77e40f Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Wed, 5 Aug 2026 15:56:14 +0000 Subject: [PATCH 08/10] Added the building of toucan --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7e07106..b71f2dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,4 +60,7 @@ RUN tar -C openfx/include -c -f - . | tar -C /usr/local/include/OpenFX -x -f - # RUN git clone https://github.com/leighsmith/toucan.git COPY . /home/ubuntu/toucan -# RUN sh toucan/sbuild-linux.sh +# Build the toucan CLI tools. +RUN sh toucan/sbuild-linux.sh + +# TODO Install the tools & libraries into a clean container. From 89843a7466e891e437815910a3e704e44e6bd362 Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Mon, 17 Aug 2026 16:06:50 -0400 Subject: [PATCH 09/10] Added -scale parameter to rescale input video frames to produce downscaled output movies, reducing the size of processed frames --- bin/toucan-render/App.cpp | 40 +++++++++++++++++++++++++++++++++------ bin/toucan-render/App.h | 5 +++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/bin/toucan-render/App.cpp b/bin/toucan-render/App.cpp index 83f658e..78f6b9b 100644 --- a/bin/toucan-render/App.cpp +++ b/bin/toucan-render/App.cpp @@ -17,6 +17,8 @@ extern "C" } // extern "C" +#include +#include #include namespace toucan @@ -70,6 +72,12 @@ namespace toucan "", "MJPEG", ftk::join(ffmpeg::getVideoCodecStrings(), ", ")); + _cmdLine.scale = ftk::CmdLineValueOption::create( + std::vector{ "-scale" }, + "Scale the rendered image size by the given factor, for example 0.5 to render " + "at half resolution. Must be greater than zero.", + "", + 1.F); _cmdLine.printStart = ftk::CmdLineFlagOption::create( std::vector{ "-print_start" }, "Print the timeline start time and exit."); @@ -106,6 +114,7 @@ namespace toucan { _cmdLine.input, _cmdLine.output }, { _cmdLine.videoCodec, + _cmdLine.scale, _cmdLine.printStart, _cmdLine.printDuration, _cmdLine.printRate, @@ -119,6 +128,11 @@ namespace toucan { _cmdLine.outputRaw = true; } + + if (_cmdLine.scale->getValue() <= 0.F) + { + throw std::runtime_error("The -scale value must be greater than zero."); + } } App::App() @@ -171,7 +185,11 @@ namespace toucan _context, inputPath.parent_path(), _timelineWrapper); - const IMATH_NAMESPACE::V2d imageSize = _graph->getImageSize(); + const IMATH_NAMESPACE::V2i nativeImageSize = _graph->getImageSize(); + const float scale = _cmdLine.scale->getValue(); + const IMATH_NAMESPACE::V2i imageSize( + std::max(1, static_cast(std::round(nativeImageSize.x * scale))), + std::max(1, static_cast(std::round(nativeImageSize.y * scale)))); // Print information. if (_cmdLine.printStart->found()) @@ -217,7 +235,7 @@ namespace toucan // Render the timeline frames. if (_cmdLine.y4m->hasValue()) { - _writeY4mHeader(); + _writeY4mHeader(imageSize); } for (OTIO_NS::RationalTime time = timeRange.start_time(); time <= timeRange.end_time_inclusive(); @@ -232,7 +250,17 @@ namespace toucan if (auto node = _graph->exec(_host, time)) { // Execute the graph. - const auto buf = node->exec(); + auto buf = node->exec(); + + // Scale the image, if requested. + if (imageSize.x != nativeImageSize.x || imageSize.y != nativeImageSize.y) + { + buf = OIIO::ImageBufAlgo::resize( + buf, + "", + 0.0, + OIIO::ROI(0, imageSize.x, 0, imageSize.y)); + } // Save the image. if (!_cmdLine.outputRaw) @@ -299,21 +327,21 @@ namespace toucan stdout); } - void App::_writeY4mHeader() + void App::_writeY4mHeader(const IMATH_NAMESPACE::V2i& imageSize) { std::string s = "YUV4MPEG2 "; fwrite(s.c_str(), s.size(), 1, stdout); { std::stringstream ss; - ss << "W" << _graph->getImageSize().x; + ss << "W" << imageSize.x; s = ss.str(); } fwrite(s.c_str(), s.size(), 1, stdout); { std::stringstream ss; - ss << " H" << _graph->getImageSize().y; + ss << " H" << imageSize.y; s = ss.str(); } fwrite(s.c_str(), s.size(), 1, stdout); diff --git a/bin/toucan-render/App.h b/bin/toucan-render/App.h index c73a206..c0e05fc 100644 --- a/bin/toucan-render/App.h +++ b/bin/toucan-render/App.h @@ -40,9 +40,9 @@ namespace toucan private: void _writeRawFrame(const OIIO::ImageBuf&); - void _writeY4mHeader(); + void _writeY4mHeader(const IMATH_NAMESPACE::V2i&); void _writeY4mFrame(const OIIO::ImageBuf&); - + struct CmdLine { std::shared_ptr > input; @@ -50,6 +50,7 @@ namespace toucan bool outputRaw = false; std::shared_ptr > videoCodec; + std::shared_ptr > scale; std::shared_ptr printStart; std::shared_ptr printDuration; std::shared_ptr printRate; From 8a010f1b24f535004a55bc70e9e00e9b6e015afb Mon Sep 17 00:00:00 2001 From: Leigh Smith Date: Wed, 19 Aug 2026 10:35:39 -0400 Subject: [PATCH 10/10] Added the reduced container, which copies the library directories, at the current expense of having to specify the absolute path to the tool --- .dockerignore | 2 ++ Dockerfile | 45 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4a246ec --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +.dockerignore diff --git a/Dockerfile b/Dockerfile index b71f2dc..ff56dc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y build-essential \ mesa-common-dev \ mesa-utils \ curl \ - pipx \ + libva-dev \ libjpeg-dev \ libtiff-dev \ libpng++-dev \ @@ -38,12 +38,6 @@ RUN tar -C feather-tk/install-feather-tk -c -f - . | tar -C /usr/local -x -f - # Add the pipx installation location: ENV PATH=/root/.local/share/pipx/venvs/conan/bin:$PATH -# ENV CMAKE_INCLUDE_PATH=/usr/include/minizip-ng - -# We need conan for openFX building. -RUN pipx ensurepath -RUN pipx install conan -RUN conan profile detect # TODO Unable to get the release because of github blocking automation. # curl -O https://github.com/AcademySoftwareFoundation/openfx/releases/download/OFX_Release_1.5.1/openfx-linux-ubuntu-1.5.1.tar.gz @@ -63,4 +57,39 @@ COPY . /home/ubuntu/toucan # Build the toucan CLI tools. RUN sh toucan/sbuild-linux.sh -# TODO Install the tools & libraries into a clean container. +# TODO Don't use the sbuild-linux.sh, install directly into /usr/local on the container. +# RUN cmake \ +# -S toucan/cmake/SuperBuild \ +# -B sbuild-Release \ +# -DCMAKE_INSTALL_PREFIX=/usr/local \ +# -DCMAKE_PREFIX_PATH=/usr/local \ +# -DCMAKE_BUILD_TYPE=Release \ +# -Dtoucan_FFmpeg_MINIMAL=OFF +# RUN cmake --build sbuild-Release -j 4 --config Release + +# RUN cmake \ +# -S toucan \ +# -B build-Release \ +# -DCMAKE_INSTALL_PREFIX=/usr/local \ +# -DCMAKE_PREFIX_PATH=/usr/local \ +# -DCMAKE_BUILD_TYPE=Release +# RUN cmake --build build-Release -j 4 --config Release +# RUN cmake --build build-Release --config Release --target install + +# Install the tools & libraries into a clean container. +FROM ubuntu:latest + +# Copy just the libraries and resources needed to operate the CLI tools. +COPY --from=builder /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/ +COPY --from=builder /usr/local/ /usr/local/ +COPY --from=builder /home/ubuntu/install-Release/ /usr/local/ + +# Define the locations to search for libraries to include local libraries. +ENV LD_LIBRARY_PATH=/usr/local/lib +WORKDIR /home/ubuntu + +# TODO for some reason, running toucan-render from the command line, using PATH to find +# it, without an absolute path causes the tool to hang, while running it as +# /usr/local/bin/toucan-render properly runs. It seems that argv[0] is used, and an +# unspecified path then causes the command to hang. The current work-around is to simply +# run it with the full path specified.