From d31979f8f58ddfcd030e5c0b1fd1346d3efdd94d Mon Sep 17 00:00:00 2001 From: MartinEesmaa Date: Sun, 8 Sep 2024 16:16:54 +1000 Subject: [PATCH] Integrated of building VVC into batch files Both shell scripts of Linux and macOS were now merged into one for detect OS with simple command For Windows build script of Visual Studio is merged into VVCEasy.bat (batch file script). Both files of Windows batch file & Unix shell script were able to build Fraunhofer VVC binaries. - Martin Eesmaa --- .gitignore | 2 + BuildVVC.sh | 90 ++++++++++++++++++++++++++++++++ VVCEasy.bat | 52 ++++++++++++++++++- vvcbuildfraun/BuildforLinux.sh | 20 -------- vvcbuildfraun/BuildforMacOS.sh | 19 ------- vvcbuildfraun/BuildforWin.bat | 93 ---------------------------------- 6 files changed, 143 insertions(+), 133 deletions(-) create mode 100644 BuildVVC.sh delete mode 100644 vvcbuildfraun/BuildforLinux.sh delete mode 100644 vvcbuildfraun/BuildforMacOS.sh delete mode 100644 vvcbuildfraun/BuildforWin.bat diff --git a/.gitignore b/.gitignore index d9d1073..72a0428 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,7 @@ uvg266/BSD/uvg266 [Oo]bj/ [Bb]in/ vvdecWebPlayer/ +vvenc/ +vvdec/ .vscode \ No newline at end of file diff --git a/BuildVVC.sh b/BuildVVC.sh new file mode 100644 index 0000000..406ae24 --- /dev/null +++ b/BuildVVC.sh @@ -0,0 +1,90 @@ +#!/bin/bash +OS=$(uname) +echo "Martin Eesmaa / VVC Compiler (vvenc and vvdec)" +echo "You're running on $OS of bash script version to compile VVC binaries" + +setup_linux() { + echo "Checking and installing required packages..." + sudo apt update && sudo apt upgrade -y + sudo apt install build-essential cmake -y +} + +setup_macos() { + echo "Please make sure Xcode is installed in your Applications." + if ! command -v brew &> /dev/null; then + echo "Homebrew is not installed. Please install Homebrew and rerun the script." + exit 1 + fi + if ! brew list | grep -q cmake; then + echo "Installing cmake..." + brew install cmake + fi +} + +setup_msys64() { + echo "Checking and installing required packages..." + pacman -Syu --noconfirm + pacman -S --noconfirm base-devel cmake git +} + +setup_freebsd() { + echo "Checking and installing required packages..." + pkg update && pkg upgrade -y + pkg install -y cmake git gmake +} + +build_repos() { + echo "Cloning repositories..." + cd ~/Downloads + + if [ ! -d vvenc ]; then + git clone --depth=1 https://github.com/fraunhoferhhi/vvenc + else + git pull -C vvenc + fi + + if [ ! -d vvdec ]; then + git clone --depth=1 https://github.com/fraunhoferhhi/vvdec + else + git pull -C vvdec + fi + + for REPO in vvenc vvdec; do + cd $REPO + mkdir build && cd build + if [ "$OS" = "Darwin" ]; then + cmake -DCMAKE_BUILD_TYPE=Release .. + cmake --build . -j $(sysctl -n hw.ncpu) + else + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-static" .. + cmake --build . -j $(nproc) + fi + cd ../../ +done + echo "Please see the build files starting with (vvenc/vvdec)/bin/release-static." +} + +# Main script execution +case "$OS" in + Linux) + setup_linux + ;; + Darwin) + setup_macos + ;; + MSYS_NT*|MINGW64*) + setup_msys64 + ;; + FreeBSD) + setup_freebsd + ;; + *) + echo "Unsupported OS: $OS" + echo "Supports Windows MSYS64, macOS, Linux & FreeBSD" + echo "May coming soon for some platforms..." + exit 1 + ;; +esac + +build_repos +read -p "Finished building vvenc & vvdec. Press [Enter] to continue..." diff --git a/VVCEasy.bat b/VVCEasy.bat index aeaa75b..2b839a2 100644 --- a/VVCEasy.bat +++ b/VVCEasy.bat @@ -85,6 +85,7 @@ echo 9. Install/Update VLC VTM Plugins (Windows/Linux x64 of VLC plugins by Inte echo 10. Install FFmpeg VVC support. echo 11. Install MPV VVC support echo 12. Tests of VVC videos +echo 13. Build vvenc & vvdec by yourself from sources set /p VVCSTART=Number: if "%VVCSTART%" == "1" goto encodestart @@ -99,6 +100,7 @@ if "%VVCSTART%" == "9" goto vlcvtmplugininstall if "%VVCSTART%" == "10" goto ffmpegvvdec if "%VVCSTART%" == "11" goto mpvandroidvvc if "%VVCSTART%" == "12" goto testsofvideo +if "%VVCSTART%" == "13" goto main123 echo Invalid input. Please enter a number between 1 and 13. pause goto start @@ -478,7 +480,7 @@ if "%vvcsampleyeah%" == n goto start :downloadvvcnowbit title Downloading VVC sample files and Coffee Run JSON & Sprite Fright JSON... from Bitmovin echo Downloading VVC sample files and Coffee Run JSON & Sprite Fright JSON from Bitmovin... -wget "https://www.dropbox.com/s/qncefmnhw8hzr2k/vvcBlogPostDemo.7z" "https://www.dropbox.com/s/ogxw1pz9pr9bphi/CoffeeRun.json" "https://www.dropbox.com/s/6kpnoin4bwzb1ob/SpriteFright.json" +wget -q https://www.dropbox.com/s/qncefmnhw8hzr2k/vvcBlogPostDemo.7z https://www.dropbox.com/s/ogxw1pz9pr9bphi/CoffeeRun.json https://www.dropbox.com/s/6kpnoin4bwzb1ob/SpriteFright.json echo Extracting from archived file... 7z x vvcBlogPostDemo.7z -aoa echo Deleting archived file... @@ -586,6 +588,54 @@ echo Press enter to go back menu. pause goto start +:main123 +title Build vvenc & vvdec by yourself from sources +cls +echo Do you want build of vvenc and vvdec yourself on your computer? +echo Before you agree to build for Windows, you need Cmake and Visual Studio on your computer. +echo Requires build to Windows VVC by Cmake 3.13.0+ (need pathed environment) and Visual Studio 2017 and later (requires Desktop C++ and only one individual component ML.NET Model Builder). +echo Requires download VVEnc and VVDec for (Git for Windows). +echo Yes means build. No means will exit the program. +echo Y/N? +set /p main1234= Answer: +if %main1234% == Y goto installmain123 +if %main1234% == y goto installmain123 +if %main1234% == N goto exit +if %main1234% == n goto exit + +:installmain123 +title Building time... +echo Building time... +echo Downloading VVENC and VVDEC from Fraunhoferhhi GitHub... +git clone --depth=1 https://github.com/fraunhoferhhi/vvenc +git clone --depth=1 https://github.com/fraunhoferhhi/vvdec +cd vvenc +mkdir build && cd build +cmake .. +cmake --build . --config Release +cd ../../ +cd vvdec +mkdir build && cd build +cmake .. +cmake --build . --config Release +cd ../../ +goto successnow + +:successnow +echo. +echo. +echo. +echo Successfully build of vvenc and vvdec on your Windows. +echo Copying executable files to build\%bit% +mkdir build\%bit% +copy vvenc\bin\release-static\*.exe build\%bit% +copy vvdec\bin\release-static\*.exe build\%bit% +echo Cleaning up of build, lib and bin folders of both dependencies... +rmdir /s /q vvenc\bin vvenc\lib vvenc\build vvdec\bin vvdec\bin vvdec\lib vvdec\build +echo Done! Press Enter to go back the menu. +pause +goto start + :error echo Your Windows version is not supported and outdated which may not work to run with VVC binaries and others too. echo This requires for Windows XP and later to use this script. diff --git a/vvcbuildfraun/BuildforLinux.sh b/vvcbuildfraun/BuildforLinux.sh deleted file mode 100644 index 1854f67..0000000 --- a/vvcbuildfraun/BuildforLinux.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -echo Martin Eesmaa / VVC Compiler (vvenc and vvdec) -echo We will check packages called: build-essential and cmake -echo It will check, if the build-essential and cmake packages are installed or not. -echo If it's already, it will update. -echo If it's not installed, we will install automatically for you. -echo. -sudo apt update && sudo apt upgrade -y -sudo apt install build-essential cmake -y -cd ~/Downloads -git clone --depth=1 https://github.com/fraunhoferhhi/vvenc -git clone --depth=1 https://github.com/fraunhoferhhi/vvdec -cd vvenc -mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-static" .. && make -cd ../../ -cd vvdec -mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-static" .. && make -cd ../../ -echo Please see the build files following starting with vvenc/bin/release-static -pause diff --git a/vvcbuildfraun/BuildforMacOS.sh b/vvcbuildfraun/BuildforMacOS.sh deleted file mode 100644 index f10ac32..0000000 --- a/vvcbuildfraun/BuildforMacOS.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -echo Martin Eesmaa / VVC Compiler (vvenc and vvdec) -echo Please make sure your Xcode is installed on your Applications. -echo. -cd ~/Downloads -git clone --depth=1 https://github.com/fraunhoferhhi/vvenc -git clone --depth=1 https://github.com/fraunhoferhhi/vvdec -cd vvenc -mkdir build && cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -cmake --build . -j $nproc -cd ../ -cd vvdec -mkdir build && cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -cmake --build . -j $nproc -cd ../ -echo Please see the build files following starting with bin/release-static -pause diff --git a/vvcbuildfraun/BuildforWin.bat b/vvcbuildfraun/BuildforWin.bat deleted file mode 100644 index 3a4c467..0000000 --- a/vvcbuildfraun/BuildforWin.bat +++ /dev/null @@ -1,93 +0,0 @@ -echo off -pushd "%~dp0" -cls - -echo. -echo :: Checking For Administrator Elevation... -echo. -timeout /t 1 /nobreak > NUL -openfiles > NUL 2>&1 -if %errorlevel%==0 ( - echo Elevation found! Proceeding... -) else ( - echo :: You are NOT running as Administrator - echo. - echo Right-click and select ^'Run as Administrator^' and try again. - echo Press any key to exit... - pause > NUL - exit -) - -goto main123 - -:main123 -title VVENC AND VVDEC (Build for Windows) (Script by Martin Eesmaa) -cls -echo Do you want build of vvenc and vvdec yourself on your computer? -echo Before you agree to build for Windows, you need Cmake and Visual Studio on your computer. -echo Requires build to Windows VVC by Cmake 3.13.0+ (need pathed environment) and Visual Studio 2017 and later (requires Desktop C++ and only one individual component ML.NET Model Builder). -echo Requires download VVEnc and VVDec for (Git for Windows). -echo Yes means build. No means will exit the program. -echo Y/N? -set /p main1234= Answer: -if %main1234% == Y goto installmain123 -if %main1234% == y goto installmain123 -if %main1234% == N goto exit -if %main1234% == n goto exit - -:installmain123 -title Building time... -echo Building time... -mkdir Windows && cd Windows -echo Download VVENC and VVDEC from Fraunhoferhhi GitHub... -git clone --depth=1 https://github.com/fraunhoferhhi/vvenc -git clone --depth=1 https://github.com/fraunhoferhhi/vvdec -cd vvenc -mkdir build && cd build -cmake .. -cmake --build . --config Release -cd ../bin/release-static -explorer . -cd ../../../ -cd vvdec -mkdir build && cd build -cmake .. -cmake --build . --config Release -cd ..\bin\release-static -explorer . -cd ../../../../ -goto successnow - -:successnow -echo. -echo. -echo. -echo Successfully build of vvenc and vvdec on your Windows. -echo Do you want delete source of VVENC and VVDEC files? Y/N? -echo. -echo WARNING!!!: YOU HAVE TO COPY EXECUTABLE FILES BEFORE YOU DELETE SOURCE FILES -echo BUG: The syntax of the command is incorrect for unknown error. -echo To see .EXE files, go to Windows/vvenc/bin/release-static in Windows Explorer. -set /p installmain1234= Answer: -if %installmain1234% == Y goto deletesourcefiles -if %installmain1234% == y goto deletesourcefiles -if %installmain1234% == N goto otherwisenow -if %installmain1234% == n goto otherwisenow - -:deletesourcefiles -title Cleaning up source files on VVENC and VVDEC on your computer... -echo Cleaning up source files on VVENC and VVDEC on your computer... -cd ../ -rmdir /s Windows -goto otherwisenow - -:otherwisenow -title Thank you for enjoying my script... (Martin Eesmaa) -echo Thank you for enjoying my script... (Martin Eesmaa) -echo Make sure go to Martin Eesmaa's GitHub: https://github.com/MartinEesmaa -echo Exiting... -timeout 3 -exit - -:exit -exit