Skip to content
Open
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
34 changes: 7 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
Vulkan-Video-Samples-win:
strategy:
matrix:
platform: [windows-x64, windows-x64-clang, windows-x64-ffmpeg, windows-x86, windows-x86-clang, win-arm64]
platform: [windows-x64, windows-x64-clang, windows-x64-without-ffmpeg, windows-x86, windows-x86-clang, win-arm64]
include:
- platform: windows-x64
arch: x64
Expand All @@ -210,16 +210,19 @@ jobs:
arch: x64
cmake_arch: x64
toolset: ClangCL
- platform: windows-x64-ffmpeg
- platform: windows-x64-without-ffmpeg
arch: x64
cmake_arch: x64
extra_cmake_flags: -DDOWNLOAD_FFMPEG=OFF
- platform: windows-x86
arch: x86
cmake_arch: Win32
extra_cmake_flags: -DDOWNLOAD_FFMPEG=OFF
- platform: windows-x86-clang
arch: x86
cmake_arch: Win32
toolset: ClangCL
extra_cmake_flags: -DDOWNLOAD_FFMPEG=OFF
- platform: win-arm64
arch: arm64
cmake_arch: ARM64
Expand All @@ -243,38 +246,14 @@ jobs:
with:
python-version: "3.10"

- name: Install FFmpeg
if: matrix.platform == 'windows-x64-ffmpeg'
run: |
# Define the custom installation location
$currentDir = pwd
$finalDestination = "$currentDir\vk_video_decoder\bin\libs\ffmpeg\win64"
echo $finalDestination

# Create the directory
New-Item -ItemType Directory -Force -Path $finalDestination

# Download FFmpeg static build
Invoke-WebRequest -Uri https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip -OutFile ffmpeg.zip

# Extract FFmpeg to the tmp location
$tempExtractPath = "$currentDir\temp\extracted"

# Extract the entire archive to a temporary folder
Expand-Archive -Path ffmpeg.zip -DestinationPath $tempExtractPath -Force
Get-ChildItem -Path $tempExtractPath\ffmpeg-master-latest-win64-gpl-shared

# Get the contents of the first folder in the archive
Get-ChildItem -Path $tempExtractPath\ffmpeg-master-latest-win64-gpl-shared | Where-Object { $_.PSIsContainer } | Copy-Item -Destination $finalDestination -Force -Recurse
echo "$finalDestination\bin" | Out-File -Encoding ASCII -Append $env:GITHUB_PATH

- name: Build Debug
shell: bash
run: |
mkdir BUILD_DEBUG
cd BUILD_DEBUG
cmake -DCMAKE_GENERATOR_PLATFORM=${{ matrix.cmake_arch }} \
${{ matrix.toolset && format('-T {0}', matrix.toolset) || '' }} \
${{ matrix.extra_cmake_flags || '' }} \
-DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --parallel $BUILD_JOBS --config Debug

Expand All @@ -285,6 +264,7 @@ jobs:
pushd BUILD_RELEASE
cmake -DCMAKE_GENERATOR_PLATFORM=${{ matrix.cmake_arch }} \
${{ matrix.toolset && format('-T {0}', matrix.toolset) || '' }} \
${{ matrix.extra_cmake_flags || '' }} \
-DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel $BUILD_JOBS --config Release
mkdir release-artifacts
Expand Down
17 changes: 10 additions & 7 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,20 @@ Windows 10 or Windows 11 with the following software packages:
- [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows)
- Install current Vulkan SDK (i.e. VulkanSDK-1.4.304.0-Installer.exe or later)
- Make sure to install the the correct SDK for the targeted system arch - x86_64 or ARM64
- [FFMPEG libraries for Windows]
- Download the latest version of the FFMPEG shared libraries archive from https://github.com/BtbN/FFmpeg-Builds/releases
- The archive must have the following pattern in the name: For Windows x86_64 ffmpeg-*-win64-*-shared.zip
- Example download link:
For Windows x86_64 https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip
For Windows ARM64 https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-winarm64-lgpl-shared.zip
- FFMPEG libraries (ONLY for Windows)
- FFmpeg is downloaded automatically during CMake configuration from https://github.com/BtbN/FFmpeg-Builds/releases
- The download is skipped if the libraries are already present in `vk_video_decoder\bin\libs\ffmpeg\<platform>\lib`
- To disable automatic download, pass `-DDOWNLOAD_FFMPEG=OFF` to CMake
- To download manually instead before the CMake configure, get the version of the FFMPEG shared libraries archive from any desired source.
- Example download link:
- For Windows x86_64 https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-lgpl-shared.zip
- For Windows ARM64 https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-winarm64-lgpl-shared.zip
- Extract to <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg
- Verify that <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg\win64\bin or <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg\winarm64\bin contains:
- Verify that <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg\win64\bin or <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg\winarm64\bin contains the required DLLs:
- avformat-59.dll
- avutil-59.dll
- avcodec-59.dll
- Note: the version might be different since the latest release is downloaded
- Verify that <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg\win64\lib or <APP_INSTALLED_LOC>\vk_video_decoder\bin\libs\ffmpeg\winarm64\lib contains the corresponding .lib files

### Windows Build Commands
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ if(BUILD_DECODER OR USE_ENCODER_SHADERC)
include(FindShaderc)
endif()

if(WIN32)
option(DOWNLOAD_FFMPEG "Automatically download FFmpeg for Windows builds" ON)
endif()

############ VULKAN_FFMPEG_LIB_PATH ######################################
if (DEFINED ENV{VULKAN_FFMPEG_LIB_DIR_PATH})
MESSAGE(STATUS "VULKAN_FFMPEG_LIB_DIR_PATH ENV VAR is set to $ENV{VULKAN_FFMPEG_LIB_DIR_PATH}")
Expand Down
46 changes: 46 additions & 0 deletions cmake/FindFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,52 @@
# FFMPEG_ROOT, if this module use this path to find FFMPEG headers
# and libraries.

if(WIN32 AND DOWNLOAD_FFMPEG)
set(FFMPEG_BTBN_TAG "autobuild-2026-03-31-13-11")
set(FFMPEG_BTBN_REVISION "n8.1-7-ga3475e2554")
set(FFMPEG_BTBN_SUFFIX "8.1")
set(FFMPEG_WIN64_SHA256 "6093603479c4bf6f14268d399a46f9ce2d050cce0a9f5e4ed81af2ac373e367b")
set(FFMPEG_WINARM64_SHA256 "055fd2c58a01042e9da66bfa046c8aa3fa7ea69b9d60fa82bfc9a1a96fc694a0")

if(CMAKE_GENERATOR_PLATFORM MATCHES "^(aarch64|arm64|ARM64)")
set(FFMPEG_PLATFORM_DIR "winarm64")
set(FFMPEG_EXPECTED_HASH "${FFMPEG_WINARM64_SHA256}")
else()
set(FFMPEG_PLATFORM_DIR "win64")
set(FFMPEG_EXPECTED_HASH "${FFMPEG_WIN64_SHA256}")
endif()

set(FFMPEG_ARCHIVE_NAME "ffmpeg-${FFMPEG_BTBN_REVISION}-${FFMPEG_PLATFORM_DIR}-lgpl-shared-${FFMPEG_BTBN_SUFFIX}")
set(FFMPEG_DOWNLOAD_URL "https://github.com/BtbN/FFmpeg-Builds/releases/download/${FFMPEG_BTBN_TAG}/${FFMPEG_ARCHIVE_NAME}.zip")
set(FFMPEG_DEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/${FFMPEG_PLATFORM_DIR}")

file(GLOB FFMPEG_EXISTING_LIBS "${FFMPEG_DEST_DIR}/lib/avcodec*.lib")
if(FFMPEG_EXISTING_LIBS)
message(STATUS "FFmpeg libraries already present in ${FFMPEG_DEST_DIR}")
else()
message(STATUS "FFmpeg libraries not found in ${FFMPEG_DEST_DIR}")
message(STATUS "Downloading FFmpeg from ${FFMPEG_DOWNLOAD_URL} ...")

include(FetchContent)
FetchContent_Declare(
ffmpeg_prebuilt
URL "${FFMPEG_DOWNLOAD_URL}"
URL_HASH "SHA256=${FFMPEG_EXPECTED_HASH}"
TLS_VERIFY ON
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
)
FetchContent_MakeAvailable(ffmpeg_prebuilt)

foreach(SUBDIR bin lib include)
if(EXISTS "${ffmpeg_prebuilt_SOURCE_DIR}/${SUBDIR}")
file(COPY "${ffmpeg_prebuilt_SOURCE_DIR}/${SUBDIR}/" DESTINATION "${FFMPEG_DEST_DIR}/${SUBDIR}")
endif()
endforeach()

message(STATUS "FFmpeg libraries installed to ${FFMPEG_DEST_DIR}")
endif()
endif()

# Macro to find header and lib directories
# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
MACRO(FFMPEG_FIND varname shortname headername)
Expand Down
Loading