diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6a3517b90..610e468cc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,6 +46,7 @@ linux-builder:
- if [ ! -f "$FFMPEG_ROOT/env.sh" ]; then echo "ERROR runner is missing $FFMPEG_ROOT"; exit 1; fi
- . "$FFMPEG_ROOT/env.sh"
- export FFMPEGDIR="$FFMPEG_ROOT"
+ - bash ci/linux/check-ffmpeg-hardware.sh "$FFMPEG_ROOT" "$CI_PROJECT_DIR/build/ffmpeg-hardware-check"
- mkdir -p build; cd build;
- pkg-config --exists libpipewire-0.3 libspa-0.2 gio-2.0 gio-unix-2.0 || echo "WARNING PipeWire Wayland capture dependencies are missing; building without Wayland capture support"
- cmake -U "*FFmpeg*" -U "*PC_av*" -U "*PC_sw*" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -D"OpenCV_DIR:PATH=$OpenCV_DIR" -D"PYTHON_MODULE_PATH=python" -D"RUBY_MODULE_PATH=ruby" -DCMAKE_BUILD_TYPE:STRING=Release -DAPPIMAGE_BUILD=1 -DUSE_SYSTEM_JSONCPP=0 -DENABLE_WAYLAND_CAPTURE=ON ../
@@ -120,6 +121,8 @@ windows-builder-x64:
- $env:MSYSTEM = "MINGW64"
- $env:FFMPEGDIR = "C:/msys64/mingw64"
- if ((& "$env:FFMPEGDIR/bin/ffmpeg.exe" -version | Select-Object -First 1) -notmatch "^ffmpeg version 7[.]1[.]") { throw "FFmpeg 7.1 is required" }
+ - $gpuEncoders = (& "$env:FFMPEGDIR/bin/ffmpeg.exe" -hide_banner -encoders 2>&1 | Out-String)
+ - 'if ($LASTEXITCODE -ne 0) { throw "Could not enumerate FFmpeg encoders" }; foreach ($codec in @("h264_nvenc", "hevc_nvenc", "h264_qsv", "hevc_qsv", "h264_amf", "hevc_amf")) { if ($gpuEncoders -notmatch "\b$codec\b") { throw "Windows FFmpeg is missing required hardware encoder $codec" } }'
- ffmpeg -hide_banner -devices | findstr /I "gdigrab"
- ffmpeg -hide_banner -devices | findstr /I "dshow"
- cmake -B build -S . -U "*FFmpeg*" -U "*PC_av*" -U "*PC_sw*" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"babl_DIR=C:/msys64/mingw64" -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x64" -D"OpenShotAudio_ROOT=$CI_PROJECT_DIR\build\install-x64" -D"OpenCV_DIR:PATH=$env:OpenCV_DIR" -D"PYTHON_MODULE_PATH=python" -D"RUBY_MODULE_PATH=ruby" -DCMAKE_AUTOGEN_PARALLEL=1 -G "MinGW Makefiles" -D"CMAKE_BUILD_TYPE:STRING=Release"
@@ -195,6 +198,8 @@ windows-builder-x86:
- $env:MSYSTEM = "MINGW32"
- $env:FFMPEGDIR = "C:/msys64/mingw32"
- if ((& "$env:FFMPEGDIR/bin/ffmpeg.exe" -version | Select-Object -First 1) -notmatch "^ffmpeg version 7[.]1[.]") { throw "FFmpeg 7.1 is required" }
+ - $gpuEncoders = (& "$env:FFMPEGDIR/bin/ffmpeg.exe" -hide_banner -encoders 2>&1 | Out-String)
+ - 'if ($LASTEXITCODE -ne 0) { throw "Could not enumerate FFmpeg encoders" }; foreach ($codec in @("h264_nvenc", "hevc_nvenc", "h264_qsv", "hevc_qsv", "h264_amf", "hevc_amf")) { if ($gpuEncoders -notmatch "\b$codec\b") { throw "Windows FFmpeg is missing required hardware encoder $codec" } }'
- ffmpeg -hide_banner -devices | findstr /I "gdigrab"
- ffmpeg -hide_banner -devices | findstr /I "dshow"
- cmake -B build -S . -U "*FFmpeg*" -U "*PC_av*" -U "*PC_sw*" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"babl_DIR=C:/msys64/mingw32" -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x86" -D"OpenShotAudio_ROOT=$CI_PROJECT_DIR\build\install-x86" -D"OpenCV_DIR:PATH=$env:OpenCV_DIR" -D"PYTHON_MODULE_PATH=python" -D"RUBY_MODULE_PATH=ruby" -DCMAKE_AUTOGEN_PARALLEL=1 -G "MinGW Makefiles" -D"CMAKE_BUILD_TYPE:STRING=Release" -D"CMAKE_CXX_FLAGS=-m32 -msse2 -mfpmath=sse" -D"CMAKE_EXE_LINKER_FLAGS=-Wl,--large-address-aware" -D"CMAKE_C_FLAGS=-m32 -msse2 -mfpmath=sse"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2396801b6..35e3a1bda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ For more information, please visit .
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
################ PROJECT VERSION ####################
-set(PROJECT_VERSION_FULL "1.1.0")
+set(PROJECT_VERSION_FULL "1.1.1")
set(PROJECT_SO_VERSION 33)
# Remove the dash and anything following, to get the #.#.# version for project()
diff --git a/ci/linux/check-ffmpeg-hardware.sh b/ci/linux/check-ffmpeg-hardware.sh
new file mode 100644
index 000000000..4c7275e21
--- /dev/null
+++ b/ci/linux/check-ffmpeg-hardware.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# SPDX-FileCopyrightText: 2026 OpenShot Studios, LLC
+# SPDX-License-Identifier: LGPL-3.0-or-later
+
+# Compiled support checks are GPU-independent. Real driver/encoding tests are separate.
+set -euo pipefail
+root=${1:?FFmpeg installation prefix}
+log=${2:-$root/hardware-validation}
+mkdir -p "$log"
+export LD_LIBRARY_PATH="$root/lib:${LD_LIBRARY_PATH:-}"
+"$root/bin/ffmpeg" -hide_banner -version > "$log/version.txt"
+"$root/bin/ffmpeg" -hide_banner -encoders > "$log/encoders.txt" 2>&1
+"$root/bin/ffmpeg" -hide_banner -hwaccels > "$log/hwaccels.txt" 2>&1
+for codec in h264_nvenc hevc_nvenc h264_qsv hevc_qsv h264_amf hevc_amf h264_vaapi hevc_vaapi; do
+ grep -Eq "[[:space:]]$codec[[:space:]]" "$log/encoders.txt" || { echo "Missing required encoder: $codec"; exit 1; }
+done
+ldd "$root/lib/libavcodec.so.61" > "$log/avcodec-dependencies.txt"
+if grep -q 'not found' "$log/avcodec-dependencies.txt"; then cat "$log/avcodec-dependencies.txt"; exit 1; fi
+grep -q 'libvpl.so.2' "$log/avcodec-dependencies.txt"
+"$root/bin/ffmpeg" -v error -f lavfi -i testsrc2=size=320x240:rate=24 -f lavfi -i sine=sample_rate=48000 -t 2 -c:v libx264 -threads 2 -c:a aac -y "$log/h264-aac.mp4"
+"$root/bin/ffmpeg" -v error -i "$log/h264-aac.mp4" -f null -
+"$root/bin/ffmpeg" -v error -f lavfi -i testsrc2=size=128x96:rate=4 -frames:v 4 -c:v libaom-av1 -cpu-used 8 -threads 2 -y "$log/av1.webm"
+"$root/bin/ffmpeg" -v error -c:v libdav1d -i "$log/av1.webm" -f null -
+echo 'SUCCESS: NVENC, QSV, AMF and VA-API encoders compiled; dispatcher linked; H.264/AAC and AV1 software smoke tests passed'
diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp
index fd66b0023..96e7dbbec 100644
--- a/src/FFmpegWriter.cpp
+++ b/src/FFmpegWriter.cpp
@@ -2808,7 +2808,8 @@ bool FFmpegWriter::write_video_packet(std::shared_ptr frame, AVFrame *fra
if (!hw_frame->hw_frames_ctx) {
std::clog << "Error hw_frames_ctx.\n";
}
- hw_frame->format = AV_PIX_FMT_NV12;
+ // Keep the hardware format assigned by av_hwframe_get_buffer().
+ // NV12 describes the CPU source, not the encoder surface.
if ( av_hwframe_transfer_data(hw_frame, frame_final, 0) < 0) {
std::clog << "Error while transferring frame data to surface.\n";
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 48b5a9c37..d668d92a0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -173,6 +173,11 @@ foreach(tname ${OPENSHOT_TESTS})
set(test_properties
LABELS ${tname}
)
+ if(tname STREQUAL "FFmpegWriter")
+ list(APPEND test_properties
+ SKIP_REGULAR_EXPRESSION "Skipping hardware encoder test:"
+ )
+ endif()
if(tname STREQUAL "FFmpegReader")
# Catch2 v2 has no native SKIP assertion. Report unavailable VAAPI
# prerequisites as skipped in CTest rather than as a passing decode test.
diff --git a/tests/FFmpegWriter.cpp b/tests/FFmpegWriter.cpp
index a5a72a46a..8c8ff181b 100644
--- a/tests/FFmpegWriter.cpp
+++ b/tests/FFmpegWriter.cpp
@@ -45,6 +45,71 @@ AVStream* first_video_stream(AVFormatContext* format_context)
}
}
+TEST_CASE("Hardware encoder uploads preserve surface format",
+ "[libopenshot][ffmpegwriter][hardware]")
+{
+#if USE_HW_ACCEL && (defined(__APPLE__) || defined(__linux__) || defined(_WIN32))
+#ifdef __APPLE__
+ const char* codec = "h264_videotoolbox";
+ const AVHWDeviceType device_type = AV_HWDEVICE_TYPE_VIDEOTOOLBOX;
+#else
+ const char* codec = "h264_nvenc";
+ const AVHWDeviceType device_type = AV_HWDEVICE_TYPE_CUDA;
+#endif
+ if (!FFmpegWriter::IsValidCodec(codec)) {
+ WARN("Skipping hardware encoder test: encoder not compiled: " << codec);
+ return;
+ }
+ AVBufferRef* device = nullptr;
+ const int device_result = av_hwdevice_ctx_create(&device, device_type, nullptr, nullptr, 0);
+ av_buffer_unref(&device);
+ if (device_result < 0) {
+ WARN("Skipping hardware encoder test: device unavailable: " << codec);
+ return;
+ }
+ // A device context alone does not guarantee an available encoding session
+ // (for example, VideoToolbox can report that its encoder is unavailable).
+ const AVCodec* encoder = avcodec_find_encoder_by_name(codec);
+ AVCodecContext* probe = avcodec_alloc_context3(encoder);
+ REQUIRE(probe != nullptr);
+ probe->width = 320;
+ probe->height = 240;
+ probe->time_base = AVRational{1, 24};
+ probe->pix_fmt = AV_PIX_FMT_NV12;
+ probe->bit_rate = 1000000;
+ const int encoder_result = avcodec_open2(probe, encoder, nullptr);
+ avcodec_free_context(&probe);
+ if (encoder_result < 0) {
+ WARN("Skipping hardware encoder test: encoding session unavailable: " << codec
+ << " (FFmpeg error " << encoder_result << ")");
+ return;
+ }
+ QTemporaryDir directory;
+ REQUIRE(directory.isValid());
+ const std::string path = directory.filePath("hardware.mp4").toStdString();
+ FFmpegWriter writer(path);
+ writer.SetVideoOptions(true, codec, Fraction(24, 1), 320, 240,
+ Fraction(1, 1), false, false, 1000000);
+ writer.Open();
+ for (int number = 1; number <= 12; ++number)
+ writer.WriteFrame(std::make_shared(number, 320, 240, "red"));
+ writer.Close();
+
+ FFmpegReader reader(path);
+ reader.Open();
+ auto decoded = reader.GetFrame(6);
+ REQUIRE(decoded->GetWidth() == 320);
+ REQUIRE(decoded->GetHeight() == 240);
+ const unsigned char* pixel = decoded->GetPixels(120) + 4 * 160;
+ CHECK(pixel[0] > 200);
+ CHECK(pixel[1] < 40);
+ CHECK(pixel[2] < 40);
+ reader.Close();
+#else
+ WARN("Skipping hardware encoder test: hardware encoding not enabled on this platform");
+#endif
+}
+
TEST_CASE("Raw video export preserves all color planes and frame ownership",
"[libopenshot][ffmpegwriter][rawvideo]")
{