m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.52k stars 263 forks source link

Play H265(HEVC MAIN10) format video with splash screen #2749

Closed dbyoung720 closed 1 week ago

dbyoung720 commented 1 month ago

ffplay -hwaccel cuda h265.mp4 Play H265(HEVC MAIN10) format video with splash screen

both WIN32/WIN64. test on WIN10X64

L4cache commented 1 month ago

ffplay uses vulkan and libplacebo for hwaccel playback, that doesn't work well with cuda I suppose. Or the nvidia driver has problem.

dbyoung720 commented 1 month ago

YES. I test on mabs build 2023-12-28, play h265 normal work.

https://github.com/dbyoung720/ffmpegSDK/tree/master/2023-12-28

L4cache commented 1 month ago

I did a build with current suite component but with these changes: which basically just pinned the version of ffmpeg and related repo to around the Dec 2023 (or Jan 2024) you mentioned and the video plays ok so this is obviously their problem (ffmpeg, vulkan-loader or libplacebo)

diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh
index 828d4c0e..2874bb8f 100644
--- a/build/media-suite_compile.sh
+++ b/build/media-suite_compile.sh
@@ -2003,7 +2003,8 @@ if { { [[ $ffmpeg != no ]] && enabled_any vulkan libplacebo; } ||
      { [[ $mpv != n ]] && ! mpv_disabled_any vulkan libplacebo; } } &&
     do_vcs "$SOURCE_REPO_VULKANLOADER" vulkan-loader; then
     _wine_mirror=https://raw.githubusercontent.com/wine-mirror/wine/master/include
-    _mabs=https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/vulkan-loader
+    # _mabs=https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/vulkan-loader
+    _mabs=https://raw.githubusercontent.com/m-ab-s/mabs-patches/c0d48551309f590db4c3e27de02bf97bb63ea086/vulkan-loader
     do_pacman_install uasm
     do_uninstall "${_check[@]}"
     do_patch "$_mabs/0001-pc-remove-CMAKE_CXX_IMPLICIT_LINK_LIBRARIES.patch" am
@@ -2233,10 +2234,12 @@ if [[ $ffmpeg != no ]]; then
             unset _openal_flag
         fi

-        if [[ ${#FFMPEG_OPTS[@]} -gt 35 ]]; then
+        if [[ ${#FFMPEG_OPTS[@]} -gt 3 ]]; then
             # remove redundant -L and -l flags from extralibs
             do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/ffmpeg/0001-configure-deduplicate-linking-flags.patch" am
         fi
+        sed -i 's/-lHLSL//g' ./configure
+        sed -i 's/-lOGLCompiler//g' ./configure

         _patches=$(git rev-list origin/master.. --count)
         [[ $_patches -gt 0 ]] &&
diff --git a/build/media-suite_deps.sh b/build/media-suite_deps.sh
index 88793ff3..80ecd675 100644
--- a/build/media-suite_deps.sh
+++ b/build/media-suite_deps.sh
@@ -53,7 +53,7 @@ SOURCE_REPO_LIBMYSOFA=https://github.com/hoene/libmysofa.git
 SOURCE_REPO_LIBOGG=https://github.com/xiph/ogg.git
 SOURCE_REPO_LIBOPENMPT=https://github.com/OpenMPT/openmpt.git#branch=OpenMPT-1.30
 SOURCE_REPO_LIBOPUSENC=https://gitlab.xiph.org/xiph/libopusenc.git
-SOURCE_REPO_LIBPLACEBO=https://code.videolan.org/videolan/libplacebo.git
+SOURCE_REPO_LIBPLACEBO=https://code.videolan.org/videolan/libplacebo.git#tag=v6.338.1
 SOURCE_REPO_LIBPNG=https://github.com/glennrp/libpng.git
 SOURCE_REPO_LIBRAV1E=https://github.com/xiph/rav1e.git
 SOURCE_REPO_LIBRESSL=https://github.com/libressl-portable/portable.git#tag=LATEST
@@ -99,7 +99,7 @@ SOURCE_REPO_UVG266=https://github.com/ultravideo/uvg266.git
 SOURCE_REPO_VIDSTAB=https://github.com/georgmartius/vid.stab.git
 SOURCE_REPO_VORBIS_TOOLS=https://github.com/xiph/vorbis-tools.git
 SOURCE_REPO_VPX=https://chromium.googlesource.com/webm/libvpx
-SOURCE_REPO_VULKANLOADER=https://github.com/KhronosGroup/Vulkan-Loader.git
+SOURCE_REPO_VULKANLOADER=https://github.com/KhronosGroup/Vulkan-Loader.git#tag=v1.3.273
 SOURCE_REPO_VVC=https://gitlab.com/m-ab-s/VVCSoftware_VTM.git
 SOURCE_REPO_X264=https://code.videolan.org/videolan/x264.git
 SOURCE_REPO_X265=https://bitbucket.org/multicoreware/x265_git.git
L4cache commented 1 month ago

I would test different versions combinations if they aren't so hard to mix and match. Thanks Khronos.

Out of all these options, only the nvenc, tesseract and lensfun are really giving me troubles (when link them to a 6 months old/younger FFmpeg). Minus the vulkan-loader and libplacebo I pinned to old version of course. (nvenc.c was referencing some now deleted macro in nv-codec-headers, after I pin the headers version to old version it can compile)

ffmpeg_options:


# Lines starting with this character are ignored
# To override some options specifically for the shared build, create a ffmpeg_options_shared.txt file.
# Basic built-in options, can be removed if you delete "--disable-autodetect"
--disable-autodetect
--enable-amf
--enable-bzlib
--enable-cuda
--enable-cuvid
--enable-d3d12va
--enable-d3d11va
--enable-dxva2
--enable-iconv
--enable-lzma
--enable-schannel
--enable-zlib
--enable-sdl2
--enable-ffnvcodec
#--enable-nvenc
--enable-nvdec
--enable-cuda-llvm
--disable-doc
# Common options
--enable-gmp
--enable-libmp3lame
--enable-libopus
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libx265
--enable-libdav1d
--enable-libaom
--disable-debug
--enable-libfdk-aac
# Zeranoe
--enable-fontconfig
--enable-gnutls
--enable-libass
--enable-libbluray
--enable-libfreetype
--enable-libharfbuzz
--enable-libmfx
--enable-libmysofa
--enable-libopencore-amrnb
--enable-libopencore-amrwb
--enable-libopenjpeg
--enable-libsnappy
--enable-libsoxr
--enable-libspeex
--enable-libtheora
--enable-libtwolame
--enable-libvidstab
--enable-libvo-amrwbenc
--enable-libwebp
--enable-libxml2
--enable-libzimg
--enable-libshine
--enable-gpl
--enable-openssl
--enable-libtls
--enable-avisynth
#--enable-mbedtls
--enable-libxvid
--enable-libopenmpt
--enable-version3
--enable-librav1e
--enable-libsrt
--enable-libgsm
--enable-libvmaf
--enable-libsvtav1
# Full
--enable-chromaprint
--enable-decklink
--enable-frei0r
--enable-libaribb24
--enable-libbs2b
--enable-libcaca
--enable-libcdio
--enable-libflite
--enable-libfribidi
--enable-libgme
--enable-libilbc
--enable-libsvthevc
--enable-libsvtvp9
--enable-libkvazaar
--enable-libmodplug
--enable-librist
--enable-librtmp
--enable-librubberband
#--enable-libtesseract
--enable-libxavs
--enable-libzmq
--enable-libzvbi
--enable-openal
--enable-libcodec2
--enable-ladspa
#--enable-vapoursynth
#--enable-liblensfun
--enable-libglslang
--enable-vulkan
--enable-libdavs2
--enable-libxavs2
--enable-libuavs3d
--enable-libplacebo
--enable-libjxl
# Full plus options that add shared dependencies
--enable-opencl
--enable-opengl
#--enable-cuda-nvcc
#--enable-libnpp
#--enable-libopenh264
L4cache commented 1 month ago

bin.7z.gz A minimalistic build you can test. The file is 7z, ".gz" is only appended to file name make github accept it.

dbyoung720 commented 1 month ago

Thank you for your work.

I test: normal play, but not use hwaccel cuda. 捕获

L4cache commented 1 month ago

You can try to set device manually via -vulkan_params device=<device name or id>

dbyoung720 commented 1 month ago

test bin.7z.gz:

Adding -vulkan_params, it can accelerate hardware, but it cannot play normally and causes screen flickering. Without adding -vulkan_params, it can play normally, but without hardware acceleration. (Dual Graphics)

on other pc: normal play, normal hardware acceleration (Single graphics card)

dbyoung720 commented 3 weeks ago

build m-ab-s 2024-08-24, test ffplay play h265 use hardware hwaccel:

Due to ffplay using Vulkan for rendering, Vulkan currently does not support all acceleration methods of ffmpeg.

ffmpeg -hwaccels return: cuda dxva2 qsv d3d11va opencl vulkan

Vulkan currently only supports CUDA and Vulkan, so other acceleration options are currently unavailable. ffplay has a bug on CUDA, so now only Vulkan can be used. ffplay -hwaccel vulkan h265.mp4, is OK。

What's amazing is that ffplay -hwaccel d3d11va h265.mp4, is also okay. -vulkan_params "device=xxx" ,It will no longer be effective. Automatically select the graphics card by the system. On a machine with dual graphics cards.

Summary: 无标题

The above test passed on two computers. One single graphics card, one dual graphics card.