rdp / ffmpeg-windows-build-helpers

Helper script for cross compiling some media tools for windows, like customizable ffmpeg.exe (with or without non-free components, etc), and some other bonuses like mplayer, mp4box, mxf, etc.
GNU General Public License v3.0
1.07k stars 409 forks source link

x265 will build 32bit on x64 #599

Closed FX8350 closed 2 months ago

FX8350 commented 2 years ago

Hi

I used this command ./cross_compile_ffmpeg.sh --disable-nonfree=n --prefer-stable=n and chose 3. Win64 (64-bit only) The build process completed without error, but the CLI shows that the built x265 (x265.exe and libx265 of ffmpeg) is 32 bit.

PS D:\bin\ffmpeg\git_20211212> ./x265 -h
x265 [info]: HEVC encoder version 3.5+20-17839cc0dv
x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit
PS D:\bin\ffmpeg\git_20211212> ./ffmpeg -i ./in.mp4 -c:v libx265 ./out.mp4
ffmpeg version N-104861-g7fe5c7f02d-ffmpeg-windows-build-helpers Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads --arch=x86_64 --target-os=mingw32 --cross-prefix=/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libopenjpeg --enable-libopenh264 --enable-liblensfun --enable-libvmaf --enable-libsrt --enable-libxml2 --enable-opengl --enable-libdav1d --enable-cuda-llvm --enable-libsvthevc --enable-libsvtav1 --enable-libaom --enable-libvpx --enable-nvenc --enable-nvdec --extra-libs=-lharfbuzz --extra-libs=-lm --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-gpl --enable-frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-avisynth --enable-libaribb24 --enable-libxvid --enable-libdavs2 --enable-libxavs2 --enable-libxavs --extra-cflags='-mtune=generic' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-decklink
  libavutil      57. 11.100 / 57. 11.100
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59. 10.100 / 59. 10.100
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 20.100 /  8. 20.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './in.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.76.100
  Duration: 00:00:21.06, start: 0.000000, bitrate: 290 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 512x288, 156 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+20-17839cc0d
x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: none!
x265 [info]: Main profile, Level-2.1 (Main tier)

Both executables were copied from ffmpeg-windows-build-helpers \ sandbox \ win64, so I don't think I chose 32 bit ... If I change to --prefer-stable=y ,then build 64 bit correctly. (bit old revision) WSL2+Ubuntu 20.04 issue?

rdp commented 2 years ago

That's odd, as far as I'm aware the 64 bit gcc can't "use" 32 bit libraries...the noasm is also a bit disconcerting...are you sure you're copying it from the right place?

On Sun, Dec 12, 2021 at 5:17 PM FX8350 @.***> wrote:

Hi

I used this command ./cross_compile_ffmpeg.sh --disable-nonfree=n --prefer-stable=n and chose 3. Win64 (64-bit only) The build process completed without error, but the CLI shows that the built x265 (x265.exe and libx265 of ffmpeg) is 32bit.

PS D:\bin\ffmpeg\git_20211212> ./x265 -h x265 [info]: HEVC encoder version 3.5+20-17839cc0dv x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit

PS D:\bin\ffmpeg\git_20211212> ./ffmpeg -i ./in.mp4 -c:v libx265 ./out.mp4 ffmpeg version N-104861-g7fe5c7f02d-ffmpeg-windows-build-helpers Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (GCC) configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads --arch=x86_64 --target-os=mingw32 --cross-prefix=/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libopenjpeg --enable-libopenh264 --enable-liblensfun --enable-libvmaf --enable-libsrt --enable-libxml2 --enable-opengl --enable-libdav1d --enable-cuda-llvm --enable-libsvthevc --enable-libsvtav1 --enable-libaom --enable-libvpx --enable-nvenc --enable-nvdec --extra-libs=-lharfbuzz --extra-libs=-lm --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-gpl --enable-frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-avisynth --enable-libaribb24 --enable-libxvid --enable-libdavs2 --enable-libxavs2 --enable-libxavs --extra-cflags='-mtune=generic' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-decklink libavutil 57. 11.100 / 57. 11.100 libavcodec 59. 14.100 / 59. 14.100 libavformat 59. 10.100 / 59. 10.100 libavdevice 59. 0.101 / 59. 0.101 libavfilter 8. 20.100 / 8. 20.100 libswscale 6. 1.101 / 6. 1.101 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './in.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.76.100 Duration: 00:00:21.06, start: 0.000000, bitrate: 290 kb/s Stream #0:00x1: Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 512x288, 156 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0] Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> hevc (libx265)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help x265 [info]: HEVC encoder version 3.5+20-17839cc0d x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit x265 [info]: using cpu capabilities: none! x265 [info]: Main profile, Level-2.1 (Main tier)

Both executables were copied from ffmpeg-windows-build-helpers \ sandbox \ win64, so I don't think I chose 32bit ... WSL2+Ubuntu 20.04 issue?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rdp/ffmpeg-windows-build-helpers/issues/599, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUGCFPH6VUVHB6FVDATUQU3QZANCNFSM5J43PMZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

FX8350 commented 2 years ago

I've tried several times, it's copying correctly from the win64 folder ... Of course, I'd deleted directories with rm -r /ffmpeg-windows-build-helpers/ before build (also rm -r ./sandbox/)

my original post, the ffmpeg configuration : --arch=x86_64 Does this mean ffmpeg built on 64 bit?

FX8350 commented 2 years ago

I tried some builds with --x265-git-checkout-version=

https://bitbucket.org/multicoreware/x265_git/commits/1e8acbf7199241034405aafabb5247c4e3e6e8d0 Up to this commit, it was built correctly in 64 bit.

https://bitbucket.org/multicoreware/x265_git/commits/4bf31dc15fb6d1f93d12ecf21fad5e695f0db5c0 Build after this commit gives the following warning

-- CMAKE_SYSTEM_PROCESSOR value `` is unknown
-- Please add this value near /ffmpeg-windows-build-helpers/sandbox/win64/x265_all_bitdepth_4bf31dc15fb6d1f93d12ecf21fad5e695f0db5c0/source/CMakeLists.txt:93
here is warning log ``` -- The C compiler identification is GNU 10.2.0 -- The CXX compiler identification is GNU 10.2.0 -- Check for working C compiler: /ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-gcc -- Check for working C compiler: /ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++ -- Check for working CXX compiler: /ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- CMAKE_SYSTEM_PROCESSOR value `` is unknown -- Please add this value near /ffmpeg-windows-build-helpers/sandbox/win64/x265_all_bitdepth_4bf31dc15fb6d1f93d12ecf21fad5e695f0db5c0/source/CMakeLists.txt:93 -- Looking for include file inttypes.h -- Looking for include file inttypes.h - found -- Performing Test CC_HAS_NO_STRICT_OVERFLOW -- Performing Test CC_HAS_NO_STRICT_OVERFLOW - Success -- Performing Test CC_HAS_NO_NARROWING -- Performing Test CC_HAS_NO_NARROWING - Success -- Performing Test CC_HAS_NO_ARRAY_BOUNDS -- Performing Test CC_HAS_NO_ARRAY_BOUNDS - Success -- Performing Test CC_HAS_FAST_MATH -- Performing Test CC_HAS_FAST_MATH - Success -- Performing Test CC_HAS_STACK_REALIGN -- Performing Test CC_HAS_STACK_REALIGN - Success -- Performing Test CC_HAS_FNO_EXCEPTIONS_FLAG -- Performing Test CC_HAS_FNO_EXCEPTIONS_FLAG - Success -- Found nasm: /usr/bin/nasm (found version "2.14.02") -- GIT_EXECUTABLE /usr/bin/git -- GIT LIVE REPO VERSION RETRIEVED -- X265 RELEASE VERSION 3.5+15-4bf31dc15 -- Looking for strtok_r -- Looking for strtok_r - found -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: ENABLE_STATIC_RUNTIME ```

And x265.exe says "32 bit with no CPU capabilities"

x265 -V
x265 [info]: HEVC encoder version 3.5+15-4bf31dc15
x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: none!

I'm not a developer, so I can't understand what's wrong with this commit...:cry:

PhiSYS commented 2 years ago

Using these options:

nice -10 ./cross_compile_ffmpeg.sh --gcc-cpu-count=8 --enable-gpl=y --disable-nonfree=n --build-intel-qsv=y --compiler-flavors=win64 --cflags='-march=skylake -O3' --build-dependencies=y --git-get-latest=y --prefer-stable=n

I can confirm when encoding:

x265 [info]: HEVC encoder version 3.5+20-17839cc0d
x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 10bit
x265 [info]: using cpu capabilities: none!

I'm on Kubuntu 21.10, and yasm v1.3.0-2.1

sfahadshahzad commented 2 years ago

Hi,

Can anyone confirm that WSL2 Ubuntu support decklink video input ?

Thanks,

Fahad

BeyondVertical commented 2 years ago

Hi,

Can anyone confirm that WSL2 Ubuntu support decklink video input ?

Thanks,

Fahad

It worked the last time I checked and all was built.

PhiSYS commented 2 years ago

I think I found something related. While this script requires yasm 1.2 and no min nasm version, right now looks like master branch of x265 wants yasm 1.3+ and nasm v2.13+ to be able to use cpu capabilities.

rdp commented 2 years ago

I see this wine ./sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/bin/x265.exe -h | head x265 [info]: build info [Windows][GCC 10.2.0][64 bit] 8bit+10bit+12bit That's not on WSL though, do you see that? Thanks!

On Fri, Feb 11, 2022 at 3:46 AM David Strencsev @.***> wrote:

I think I found something related. While this script requires yasm 1.2 https://github.com/rdp/ffmpeg-windows-build-helpers/blob/b369f417b6c8d7877c07173da71a44663a89561c/cross_compile_ffmpeg.sh#L185, right now x265 wants yasm 1.3+ to be able to use cpu capabilities https://github.com/videolan/x265/blob/master/build/README.txt#L28.

— Reply to this email directly, view it on GitHub https://github.com/rdp/ffmpeg-windows-build-helpers/issues/599#issuecomment-1036075459, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUHNHPAXO52EOF3FCVLU2TSJJANCNFSM5J43PMZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

PhiSYS commented 2 years ago

Minutes ago I cloned a the clean repo.

Then used this to compile [in native Kubuntu Linux 21.10]:

$ nice ./cross_compile_ffmpeg.sh --gcc-cpu-count=8 --enable-gpl=y --disable-nonfree=n --build-intel-qsv=y --compiler-flavors=win64 --build-dependencies=y --git-get-latest=y --prefer-stable=n

Then I took the binaries and went to a real Windows machine.

Issue (32bit noasm) still persist in x265.exe [in native Windows 10]:

> x265 --help
x265 [info]: HEVC encoder version 3.5+29-3415705dd
x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit

Issue (32bit noasm) still persist in ffmpeg.exe [in native Windows 10]:

> ffmpeg.exe -i input.mkv -c:v libx265 output.mkv
...
x265 [info]: HEVC encoder version 3.5+29-3415705dd
x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 10bit
x265 [info]: using cpu capabilities: none!

As a side note, I've been able to compile x265 in linux (for linux) from its current source (videolan, not multicoreware) and it compiled nicely 64-bit and assembly cpu capabilities.

rdp commented 2 years ago

Yeah that's really weird. Mine says

x265.exe [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit

Seems it's still a 64 bit executable: $ file x265.exe: PE32+ executable (console) x86-64, for MS Windows I tried a few things and couldn't fix it, maybe we should file a bug with the x265 people or see if they know anything about it? Thanks!

On Sun, Feb 13, 2022 at 2:29 AM David Strencsev @.***> wrote:

Cloned a clean repo.

Then used this to compile in native [Kubuntu Linux 21.10]:

$ nice -10 ./cross_compile_ffmpeg.sh --gcc-cpu-count=8 --enable-gpl=y --disable-nonfree=n --build-intel-qsv=y --compiler-flavors=win64 --build-dependencies=y --git-get-latest=y --prefer-stable=n

Issue (32bit noasm) still persist in x265.exe [in native Windows 10]:

x265 --help x265 [info]: HEVC encoder version 3.5+29-3415705dd x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit

Issue (32bit noasm) still persist in ffmpeg.exe [in native Windows 10]:

ffmpeg.exe -i input.mkv -c:v libx265 output.mkv ... x265 [info]: HEVC encoder version 3.5+29-3415705dd x265 [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 10bit x265 [info]: using cpu capabilities: none!

As a side note, I've been able to compile x265 in linux (for linux) from its current source to test if the problem was related to current source code, but it compiled nicely 64-bit and assembly cpu capabilities.

— Reply to this email directly, view it on GitHub https://github.com/rdp/ffmpeg-windows-build-helpers/issues/599#issuecomment-1037959719, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUD7I2QO6CVG7OYZDTLU252XRANCNFSM5J43PMZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Warblefly commented 2 years ago

On Wed, 23 Feb 2022, 06:18 Roger Pack, @.***> wrote:

Yeah that's really weird. Mine says

x265.exe [info]: build info [Windows][GCC 10.2.0][32 bit][noasm] 8bit+10bit+12bit

Seems it's still a 64 bit executable: $ file x265.exe: PE32+ executable (console) x86-64, for MS Windows

I understand there's been a fix in x265 to correct this. Its code was incorrectly detecting the target host upon compilation.

Krautmaster commented 2 years ago

i have the same issue as it seems as i wondered why it is that slow. It is not using any CPU feature at all. See https://superuser.com/questions/1707063/same-ffmpeg-preset-got-way-slower-in-x265-compared-to-a-year-ago-why image

bare GIT checkout and ./cross_compile_ffmpeg.sh --git-get-latest=y --disable-nonfree=n --compiler-flavors=win64 --sandbox-ok=y --gcc-cpu-count=4 --prefer-stable=n

image

still converting without CPU features on my workstation while other builds from external like here do https://github.com/AnimMouse/ffmpeg-autobuild

Did a fresh build; image

./cross_compile_ffmpeg.sh --gcc-cpu-count=8 --enable-gpl=y --disable-nonfree=n --build-intel-qsv=y --compiler-flavors=win64 --cflags='-march=skylake -O3' --build-dependencies=y --git-get-latest=y --prefer-stable=n

image

Krautmaster commented 2 years ago

also see https://trac.macports.org/ticket/64528

rdp commented 1 year ago

I pinged the libx265 group on it, no response yet...

On Wed, Mar 9, 2022 at 8:19 AM Krautmaster @.***> wrote:

also see https://trac.macports.org/ticket/64528

— Reply to this email directly, view it on GitHub https://github.com/rdp/ffmpeg-windows-build-helpers/issues/599#issuecomment-1063030272, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUDJ5DX5M65ED7QNAJ3U7C6PFANCNFSM5J43PMZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>