Last active
October 12, 2024 22:56
-
-
Save DevStefIt/ed0330d1fd8c8f8d2b96db6c3160cc66 to your computer and use it in GitHub Desktop.
libx265 compiling on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command | |
git clone https://bitbucket.org/multicoreware/x265_git | |
mv x265_git x265 | |
# Modify "ffmpeg_build/sources/x265/source/CMakeLists.txt with the following edit | |
# | |
# add_definitions(/Ob2) # always inline | |
# | |
# To: | |
# if(CMAKE_BUILD_TYPE STREQUAL "Release") | |
# add_definitions(/Ob2) # always inline, only for release | |
# endif() | |
# | |
sed -i 's| add_definitions(/Ob2) # always inline| if(CMAKE_BUILD_TYPE STREQUAL "Release")\n add_definitions(/Ob2) # always inline, only for release\n endif()|g' x265/source/CMakeLists.txt | |
cd ../build | |
mkdir x265 | |
cd x265 | |
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="../../installed/x265" -DCMAKE_BUILD_TYPE=Debug -DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DCMAKE_CXX_FLAGS="-DWIN32 -D_WINDOWS -W4 -GR -EHsc" -DCMAKE_C_FLAGS="-DWIN32 -D_WINDOWS -W4" -DCMAKE_CXX_FLAGS_RELEASE="-MT -O2 -Ob2 -DNDEBUG" -DCMAKE_C_FLAGS_RELEASE="-MT -O2 -Ob2 -DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-MTd -Zi -Ob0 -Od -RTC1" -DCMAKE_C_FLAGS_DEBUG="-MTd -Zi -Ob0 -Od -RTC1" -DCMAKE_EXE_LINKER_FLAGS="-DEBUG" ../../sources/x265/source | |
cmake --build . --config Debug --target install | |
# or, if you prefer | |
# nmake | |
# nmake install | |
mv ../../installed/x265/lib/x265-static.lib ../../installed/x265/lib/x265.lib | |
# Test script | |
cd ../../installed/x265/bin | |
./x265 --crf 18 --preset slow --output output_file.mkv input_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://bitbucket.org/multicoreware/x265_git | |
mv x265_git x265 | |
cd ../build | |
mkdir x265 | |
cd x265 | |
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="../../installed/x265" -DCMAKE_BUILD_TYPE=Release -DENABLE_CLI=ON -DENABLE_SHARED=OFF -DCMAKE_CXX_FLAGS="-DWIN32 -D_WINDOWS -W4 -GR -EHsc" -DCMAKE_C_FLAGS="-DWIN32 -D_WINDOWS -W4" -DCMAKE_CXX_FLAGS_RELEASE="-MT -O2 -Ob2 -DNDEBUG" -DCMAKE_C_FLAGS_RELEASE="-MT -O2 -Ob2 -DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-MTd -Zi -Ob0 -Od -RTC1" -DCMAKE_C_FLAGS_DEBUG="-MTd -Zi -Ob0 -Od -RTC1" ../../sources/x265/source | |
cmake --build . --config Release --target install | |
# or, if you prefer | |
# nmake | |
# nmake install | |
mv ../../installed/x265/lib/x265-static.lib ../../installed/x265/lib/x265.lib | |
# Test script | |
cd ../../installed/x265/bin | |
./x265 --crf 18 --preset slow --output output_file.mkv input_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment