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.08k stars 412 forks source link

Request: Add libsvt_vp9 (Code Provided) #725

Closed stickman561 closed 7 months ago

stickman561 commented 7 months ago

svt_vp9 is finally somewhat stable with FFMPEG and provides a massive speed advantage over libvpx with comparable quality. I've added the following code blocks to my local cross_compile_ffmpeg.sh and am able to build without any issues, --help supported and all, so I figured I'd see if you could add it officially. (Unfortunately I forgot to check my local branch first and it's very out of sync with master, hence the lack of a pull request.)

Added between build_svt-hevc() and build_svt-av1():

build_svt-vp9() { do_git_checkout https://github.com/OpenVisualCloud/SVT-VP9.git cd SVT-VP9_git cd Build do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=AMD64" do_make_and_make_install cd ../.. }

Added after $build_svt_hevc check (inside of not 32 bit check): `if [[ $build_svt_vp9 = y ]]; then

SVT-VP9

    # Apply the correct patches based on version. Logic (n4.4 patch for n4.2, n4.3 and n4.4)  based on patch notes here:
    # https://github.com/OpenVisualCloud/SVT-VP9/tree/master/ffmpeg_plugin
    if [[ $ffmpeg_git_checkout_version == *"n4.3.1"* ]]; then
      git apply "$work_dir/SVT-VP9_git/ffmpeg_plugin/n4.3.1-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch"
    elif [[ $ffmpeg_git_checkout_version == *"n4.2.3"* ]]; then
      git apply "$work_dir/SVT-VP9_git/ffmpeg_plugin/n4.2.3-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch"
    elif [[ $ffmpeg_git_checkout_version == *"n4.2.2"* ]]; then
      git apply "$work_dir/SVT-VP9_git/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch"
    else
      # newer:
      git apply "$work_dir/SVT-VP9_git/ffmpeg_plugin/master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch"
    fi
    config_options+=" --enable-libsvtvp9"`

Added after second $build_svt_hevc check (just after frei0r, also inside not 32 bit check): if [[ $build_svt_vp9 = y ]]; then build_svt-vp9 fi

Added to flag defaults after build_svt_hevc=n build_svt_vp9=n

Added to flag documentation after svt_hevc flag: --build-svt-vp9=n [builds libsvt-vp9 modules within ffmpeg etc.]

Added to flags list after --build-svt-hevc= `--build-svt-vp9= ) build_svt_vp9="${1#*=}"; shift ;;`

Implementing all of these should allow users the option to include libsvt_vp9 with their builds and get drastically faster VP9 encoding, useful for Discord embeds as the most efficient codec currently supported by the platform.

stickman561 commented 7 months ago

Great, the markdown on the GitHub comment messes with the formatting. Hopefully if you copy it to your local editor it should clean up easily.

stickman561 commented 7 months ago

Forked and re-implemented new functionality. After testing appears everything is still compatible with the latest commit. PR opened.