Compare commits

...
19 Commits
Author SHA1 Message Date
levogevo c49901597c bump ffmpeg 8.1.1 -> 8.1.2 2026-07-13 15:13:01 -05:00
levogevo b1afb83db4 update efg to use print_opt_map 2026-05-31 16:40:27 -05:00
levogevo 4e1aac1284 generate encode usage programatically 2026-05-31 12:20:49 -05:00
levogevo 14249e814b bump versions 2026-05-27 17:46:48 -05:00
levogevo ddf2fa103c bump svtav1_hdr to 4.1.0 2026-05-02 14:56:58 -05:00
levogevo 9962071250 update get_crop install install_deps 2026-04-25 20:44:59 -05:00
levogevo 0e436efc3f update README 2026-04-03 20:31:26 -05:00
levogevo 63f674e95a update readme and warning 2026-03-29 11:26:02 -05:00
levogevo e2441ea693 libjxl tools depend on libwebp 2026-03-28 21:29:03 -05:00
levogevo 7db4289f0e fix libsnappy with PGO 2026-03-28 14:08:19 -05:00
levogevo 8597ca6088 add libsnappy/lcms2 to enable and reformat BUILDS_CONF 2026-03-27 20:44:06 -05:00
levogevo 4092e0f215 turn DEBUG off for Jenkinsfile by default 2026-03-27 17:50:07 -05:00
levogevo fc61040607 disable jxl jni 2026-03-27 14:36:40 -05:00
levogevo 9338ec4039 bump bluray and use different symbol 2026-03-27 12:11:41 -05:00
levogevo cd9e42cd4d fix improper cmake build 2026-03-27 10:43:34 -05:00
levogevo bd2f457181 fixup libjxl build 2026-03-27 09:24:21 -05:00
levogevo d001965e71 fix svtav1 v4 build and libjxl shared 2026-03-24 12:44:50 -05:00
levogevo 2705245670 bump ffmpeg/svtav1 versions 2026-03-24 11:58:17 -05:00
levogevo 89c7704a0e add libbluray,libjxl 2026-03-24 11:56:16 -05:00
16 changed files with 644 additions and 335 deletions
+12
View File
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
Vendored
+3 -3
View File
@@ -14,7 +14,7 @@ def withDockerCreds(body) {
pipeline {
agent none
environment {
DEBUG = "1"
DEBUG = "0"
HEADLESS = "1"
}
options { buildDiscarder logRotator(numToKeepStr: '4') }
@@ -41,7 +41,7 @@ pipeline {
axes {
axis {
name 'COMP_OPTS';
values 'OPT=0 LTO=OFF STATIC=OFF', 'OPT=2 LTO=OFF', 'PGO=ON'
values 'OPT=0 LTO=OFF STATIC=OFF', 'OPT=2 LTO=OFF', 'PGO=ON PACKAGE=ON'
}
}
stages {
@@ -62,7 +62,7 @@ pipeline {
axis { name 'DISTRO'; values 'ubuntu', 'fedora', 'debian', 'archlinux' }
axis {
name 'COMP_OPTS';
values 'OPT=0 LTO=OFF STATIC=OFF', 'OPT=2 LTO=OFF', 'PGO=ON'
values 'OPT=0 LTO=OFF STATIC=OFF', 'OPT=2 LTO=OFF', 'PGO=ON PACKAGE=ON'
}
}
stages {
+35 -10
View File
@@ -24,14 +24,39 @@ Configuration is done through environment variables.
By default, this project will build a static `ffmpeg` binary in `./gitignore/sysroot/bin/ffmpeg`.
The user-overridable compile options are:
- `ENABLE`: configure what ffmpeg enables (default: libaom libass libvpx libxml2 libvmaf libx264 libx265 libwebp libopus librav1e libdav1d libvorbis libmp3lame libfribidi libfreetype libharfbuzz libopenjpeg libsvtav1_hdr libfontconfig )
- `PREFIX`: prefix to install to, default is local install in ./gitignore/sysroot (default: local)
- `STATIC`: static or shared build (default: ON)
- `LTO`: enable link time optimization (default: ON)
- `CLEAN`: clean build directories before building (default: ON)
- `PGO`: enable profile guided optimization (default: OFF)
- `ARCH`: architecture type (x86-64-v{1,2,3,4}, armv8-a, etc) (default: native)
- `OPT`: optimization level (0-3) (default: 3)
- `ENABLE`: configure what ffmpeg enables. default:
lcms2
libaom
libass
libvpx
libjxl
libxml2
libvmaf
libx264
libx265
libwebp
libopus
librav1e
libdav1d
libbluray
libsnappy
libvorbis
libmp3lame
libfribidi
libfreetype
libharfbuzz
libopenjpeg
libsvtav1_hdr
libfontconfig
- `PREFIX`: path to install to, local install is in ./gitignore/sysroot. default: local
- `STATIC`: static (ON) or shared (OFF) build. default: ON
- `LTO`: enable link time optimization (ON/OFF). default: ON
- `CLEAN`: clean build directories before building (ON/OFF). default: ON
- `PGO`: enable profile guided optimization (ON/OFF). default: OFF
- `PACKAGE`: package ffmpeg binaries to tarball in ./gitignore/package (ON/OFF). default: OFF
- `ARCH`: architecture type (x86-64-v{1,2,3,4}, armv8-a, etc). default: native
- `OPT`: optimization level (0-3). default: 3
Examples:
- only build libsvtav1_psy and libopus: `ENABLE='libsvtav1_psy libopus' ./scripts/build.sh`
@@ -55,7 +80,7 @@ ENABLE='libdav1d' ./scripts/docker_run_image.sh ubuntu ./scripts/build.sh
# Encoding scripts
The encoding scripts are designed to be installed to system paths for re-use via symbolic links back to this repo using the `-I` flag.
## Encoding with svtav1-psy and opus
## Encoding with svtav1 and opus
```bash
encode -i input [options] output
[-P NUM] set preset (default: 3)
@@ -73,7 +98,7 @@ encode -i input [options] output
[-I] system install at /usr/local/bin/encode
[-U] uninstall from /usr/local/bin/encode
```
- Uses svtav1-psy for the video encoder.
- Uses svtav1 for the video encoder.
- Uses libopus for the audio encoder.
- Skips re-encoding av1/opus streams.
- Only maps audio streams that match the video stream language if the video stream has a defined language.
+117 -5
View File
@@ -27,7 +27,7 @@ echo_wrapper() {
echo -e "${args[@]}" "${color}${word:-''}${endColor}" "$@"
}
echo_fail() { color="${RED}" word="FAIL" echo_wrapper "$@"; }
echo_fail() { color="${RED}" word="FAIL" echo_wrapper "$@" 1>&2; }
echo_info() { color="${CYAN}" word="INFO" echo_wrapper "$@"; }
echo_pass() { color="${GREEN}" word="PASS" echo_wrapper "$@"; }
echo_warn() { color="${YELLOW}" word="WARN" echo_wrapper "$@"; }
@@ -301,6 +301,14 @@ print_os() {
echo "${FB_OS}"
}
set_sudo() {
if is_windows || test "$(id -u)" -eq 0; then
SUDO=''
else
SUDO='sudo '
fi
}
is_positive_integer() {
local input="$1"
if [[ ${input} != ?(-)+([[:digit:]]) || ${input} -lt 0 ]]; then
@@ -412,6 +420,25 @@ using_cmake3() {
line_starts_with "${cmakeVersion}" 3
}
get_cmake_flag() {
local findFlag="$1"
shift
local flags=("$@")
local flagOption
for flag in "${flags[@]}"; do
if line_starts_with "${flag}" "-D${findFlag}="; then
IFS='=' read -r _ flagOption <<<"${flag}"
fi
done
if [[ -z ${flagOption} ]]; then
echo_fail "could not find ${findFlag} from ${flags[*]}"
return 1
else
echo "${flagOption}"
fi
}
have_req_meson_version() {
local min=1.6.1
have_required_version "$(meson --version)" "${min}"
@@ -431,7 +458,7 @@ have_required_version() {
recreate_dir() {
local dirs=("$@")
for dir in "${dirs[@]}"; do
test -d "${dir}" && rm -rf "${dir}"
test -d "${dir}" && ${SUDO_MODIFY} rm -rf "${dir}"
mkdir -p "${dir}" || return 1
done
}
@@ -439,7 +466,7 @@ recreate_dir() {
ensure_dir() {
local dirs=("$@")
for dir in "${dirs[@]}"; do
test -d "${dir}" || mkdir -p "${dir}" || return 1
test -d "${dir}" || ${SUDO_MODIFY} mkdir -p "${dir}" || return 1
done
}
@@ -449,7 +476,8 @@ get_date() {
get_remote_head() {
local url="$1"
# ${build} is magically populated from get_build_conf
local build="$2"
local ver="$3"
local remoteCommitFile="${TMP_DIR}/${build}-remote-head.txt"
local date="$(get_date)"
# want to cache the remote head for faster retrieval
@@ -463,7 +491,7 @@ get_remote_head() {
remoteHEAD="${prevCommit}"
else
IFS=$' \t' read -r remoteHEAD _ <<< \
"$(git ls-remote "${url}" HEAD)"
"$(git ls-remote "${url}" "${ver}")"
echo "${date} ${build} ${remoteHEAD}" >"${remoteCommitFile}"
fi
echo "${remoteHEAD}"
@@ -540,3 +568,87 @@ check_for_supmover() {
SUPMOVER="${LOCAL_PREFIX}/bin/supmover"
test -f "${SUPMOVER}" || do_build supmover || return 1
}
repeat_character() {
local char="$1"
local count="$2"
local spaces
printf -v spaces "%${count}s" ''
echo "${spaces// /${char}}"
}
# read given varnames to set:
# - index array
# - short option array
# - long option array
# - option description array with
# padding based off of longest option
parse_opt_map() {
local optIndexVarname="$1"
local shortOptVarname="$2"
local longOptVarname="$3"
local descOptVarname="$4"
shift 4
local optMap=("$@")
declare -n optIndex="${optIndexVarname}"
declare -n shortOpt="${shortOptVarname}"
declare -n longOpt="${longOptVarname}"
declare -n descOpt="${descOptVarname}"
local opt index short long desc
local longestOpt=0
for opt in "${optMap[@]}"; do
read -r short long desc <<<"${opt}"
# check for duplicate/overwrites
if line_contains "${shortOpt[*]}" "${short}"; then
echo_fail "${short} already defined"
return 1
fi
if line_contains "${longOpt[*]}" "${long}"; then
echo_fail "${long} already defined"
return 1
fi
# --flag -> flag
index="${long//--/}"
optIndex+=("${index}")
shortOpt["${index}"]="${short}"
longOpt["${index}"]="${long}"
descOpt["${index}"]="${desc}"
# track longest longOpt to pad the description
if [[ ${longestOpt} -lt ${#long} ]]; then
longestOpt=${#long}
fi
done
local longLen
local tab=$'\t\t'
for ind in "${optIndex[@]}"; do
long="${longOpt[${ind}]}"
longLen=${#long}
padding="$(repeat_character ' ' $((longestOpt - longLen)))"
descOpt["${ind}"]="${padding}${tab}${descOpt[${ind}]}"
done
}
print_opt_map() {
local optionMap=("$@")
local OPT_INDS
declare -A SHORT_OPTS LONG_OPTS DESC_OPTS
parse_opt_map \
OPT_INDS \
SHORT_OPTS \
LONG_OPTS \
DESC_OPTS \
"${optionMap[@]}" || return 1
echo -e "\nOPTIONS:"
for ind in "${OPT_INDS[@]}"; do
echo -e " ${SHORT_OPTS[${ind}]}, ${LONG_OPTS[${ind}]}${DESC_OPTS[${ind}]}"
done
echo
}
+175 -98
View File
@@ -29,6 +29,11 @@ set_compile_opts() {
PGO_FLAG
LIB_SUFF
BUILD_TYPE
NO_BUILD_TYPE
SHARED
BINDIR
LIBDIR
INCDIR
)
unset "${BUILD_ENV_NAMES[@]}"
export "${EXPORTED_ENV_NAMES[@]}"
@@ -37,6 +42,10 @@ set_compile_opts() {
JOBS="$(nproc)"
# local vs system prefix
test "${PREFIX}" == 'local' && PREFIX="${LOCAL_PREFIX}"
# relevant prefix directories
BINDIR="${PREFIX}/bin"
LIBDIR="${PREFIX}/lib"
INCDIR="${PREFIX}/include"
# check if we need to handle PREFIX with sudo
local testfile=''
@@ -51,14 +60,11 @@ set_compile_opts() {
SUDO_MODIFY=''
else
SUDO_MODIFY="${SUDO}"
echo_warn "using ${SUDO}to install"
${SUDO_MODIFY} mkdir -p "${PREFIX}/bin/" || return 1
echo_warn "using ${SUDO}to modify PREFIX"
fi
test -f "${testfile}" && ${SUDO_MODIFY} rm "${testfile}"
test -d "${PREFIX}" || { ${SUDO_MODIFY} mkdir -p "${PREFIX}" || return 1; }
ensure_dir "${BINDIR}" || return 1
# set library/pkgconfig directory
LIBDIR="${PREFIX}/lib"
LDFLAGS_ARR=("-L${LIBDIR}")
# android has different library location/names
@@ -165,7 +171,7 @@ fi' >"${compilerDir}/which"
"-DCMAKE_C_COMPILER_LAUNCHER=ccache"
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
"-DCMAKE_VERBOSE_MAKEFILE=ON"
"-G" "Ninja"
"-GNinja"
"-DENABLE_STATIC=${STATIC}"
"-DBUILD_STATIC_LIBS=${STATIC}"
"-DBUILD_TESTING=OFF"
@@ -180,7 +186,7 @@ fi' >"${compilerDir}/which"
# add prefix include
# TODO use cygpath for windows
CPPFLAGS_ARR+=("-I${PREFIX}/include")
CPPFLAGS_ARR+=("-I${INCDIR}")
# if PGO is enabled, first build run will be to generate
# second run will be to use generated profdata
@@ -228,15 +234,9 @@ fi' >"${compilerDir}/which"
# static/shared linking
if [[ ${STATIC} == 'ON' ]]; then
BUILD_TYPE=static
CONFIGURE_FLAGS+=(
'--enable-static'
'--disable-shared'
)
NO_BUILD_TYPE=shared
SHARED=OFF
MESON_FLAGS+=('--default-library=static')
CMAKE_FLAGS+=(
"-DENABLE_SHARED=OFF"
"-DBUILD_SHARED_LIBS=OFF"
)
# darwin does not support -static
if is_darwin; then
FFMPEG_EXTRA_FLAGS+=("--extra-ldflags=${LDFLAGS_ARR[*]}")
@@ -244,14 +244,11 @@ fi' >"${compilerDir}/which"
FFMPEG_EXTRA_FLAGS+=("--extra-ldflags=${LDFLAGS_ARR[*]} -static")
fi
FFMPEG_EXTRA_FLAGS+=("--pkg-config-flags=--static")
# remove shared libraries for static builds
USE_LIB_SUFF="${STATIC_LIB_SUFF}"
DEL_LIB_SUFF="${SHARED_LIB_SUFF}"
else
BUILD_TYPE=shared
NO_BUILD_TYPE=static
SHARED=ON
CMAKE_FLAGS+=(
"-DENABLE_SHARED=ON"
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_INSTALL_RPATH=${LIBDIR}"
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
)
@@ -263,15 +260,18 @@ fi' >"${compilerDir}/which"
fi
FFMPEG_EXTRA_FLAGS+=("--extra-ldflags=${LDFLAGS_ARR[*]}")
LDFLAGS_ARR+=("-Wl,-rpath,${LIBDIR}")
CONFIGURE_FLAGS+=(
'--enable-shared'
'--disable-static'
)
FFMPEG_EXTRA_FLAGS+=('--enable-rpath')
# remove static libraries for shared builds
USE_LIB_SUFF="${SHARED_LIB_SUFF}"
DEL_LIB_SUFF="${STATIC_LIB_SUFF}"
fi
CMAKE_FLAGS+=(
"-DENABLE_SHARED=${SHARED}"
"-DBUILD_SHARED_LIBS=${SHARED}"
)
CONFIGURE_FLAGS+=(
"--enable-${BUILD_TYPE}"
"--disable-${NO_BUILD_TYPE}"
)
declare -gn USE_LIB_SUFF="${BUILD_TYPE^^}_LIB_SUFF"
declare -gn DEL_LIB_SUFF="${NO_BUILD_TYPE^^}_LIB_SUFF"
# architecture/cpu compile flags
# arm prefers -mcpu over -march for native builds
@@ -322,6 +322,8 @@ fi' >"${compilerDir}/which"
echo
}
# BUILDS_CONF intentionally does not expand variables
# shellcheck disable=SC2016
get_build_conf() {
local getBuild="${1}"
local getBuildValue="${2:-}"
@@ -332,63 +334,68 @@ get_build_conf() {
local padding=4
# name version file-extension url dep1,dep2
# shellcheck disable=SC2016
local BUILDS_CONF='
ffmpeg 8.0.1 tar.gz https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n${ver}.${ext}
libsvtav1_hdr 4.0.1 tar.gz https://github.com/juliobbv-p/svt-av1-hdr/archive/refs/tags/v${ver}.${ext} dovi_tool,hdr10plus_tool,cpuinfo
libsvtav1_psy 3.0.2-B tar.gz https://github.com/BlueSwordM/svt-av1-psyex/archive/refs/tags/v${ver}.${ext} dovi_tool,hdr10plus_tool,cpuinfo
hdr10plus_tool 1.7.2 tar.gz https://github.com/quietvoid/hdr10plus_tool/archive/refs/tags/${ver}.${ext}
dovi_tool 2.3.1 tar.gz https://github.com/quietvoid/dovi_tool/archive/refs/tags/${ver}.${ext}
cpuinfo latest git https://github.com/pytorch/cpuinfo/
libsvtav1 4.0.1 tar.gz https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${ver}/SVT-AV1-v${ver}.${ext}
librav1e 0.8.1 tar.gz https://github.com/xiph/rav1e/archive/refs/tags/v${ver}.${ext}
libaom 3.13.1 tar.gz https://storage.googleapis.com/aom-releases/libaom-${ver}.${ext}
libvmaf 3.0.0 tar.gz https://github.com/Netflix/vmaf/archive/refs/tags/v${ver}.${ext}
libopus 1.6 tar.gz https://github.com/xiph/opus/archive/refs/tags/v${ver}.${ext}
libdav1d 1.5.3 tar.xz https://downloads.videolan.org/videolan/dav1d/${ver}/dav1d-${ver}.${ext}
libx264 latest git https://code.videolan.org/videolan/x264.git
libmp3lame 3.100 tar.gz https://pilotfiber.dl.sourceforge.net/project/lame/lame/${ver}/lame-${ver}.${ext}
libvpx 1.16.0 tar.gz https://github.com/webmproject/libvpx/archive/refs/tags/v${ver}.${ext}
libvorbis 1.3.7 tar.xz https://github.com/xiph/vorbis/releases/download/v${ver}/libvorbis-${ver}.${ext} libogg,cmake3
libogg 1.3.6 tar.xz https://github.com/xiph/ogg/releases/download/v${ver}/libogg-${ver}.${ext}
libopenjpeg 2.5.4 tar.gz https://github.com/uclouvain/openjpeg/archive/refs/tags/v${ver}.${ext} libtiff,lcms2
ffmpeg 8.1.2 tar.gz https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n${ver}.${ext}
'
# ffmpeg --enable packages
BUILDS_CONF+='
lcms2 2.18 tar.gz https://github.com/mm2/Little-CMS/archive/refs/tags/lcms${ver}.${ext} libtiff,libjpeg
libtiff 4.7.1 tar.gz https://github.com/libsdl-org/libtiff/archive/refs/tags/v${ver}.${ext} libwebp,libdeflate,xz,zstd
libaom 3.13.1 tar.gz https://storage.googleapis.com/aom-releases/libaom-${ver}.${ext}
libass 0.17.4 tar.xz https://github.com/libass/libass/releases/download/${ver}/libass-${ver}.${ext} libfontconfig,libfreetype,libharfbuzz,libfribidi,libunibreak,libxml2,xz
libvpx 1.16.0 tar.gz https://github.com/webmproject/libvpx/archive/refs/tags/v${ver}.${ext}
libjxl v0.11.2 git https://github.com/libjxl/libjxl brotli,libpng,libwebp
libxml2 2.15.1 tar.gz https://github.com/GNOME/libxml2/archive/refs/tags/v${ver}.${ext}
libvmaf 3.0.0 tar.gz https://github.com/Netflix/vmaf/archive/refs/tags/v${ver}.${ext}
libx264 master git https://code.videolan.org/videolan/x264.git
libx265 4.1 tar.gz http://ftp.videolan.org/pub/videolan/x265/x265_${ver}.${ext} libnuma,cmake3
libwebp 1.6.0 tar.gz https://github.com/webmproject/libwebp/archive/refs/tags/v${ver}.${ext} libpng,libjpeg
libjpeg 3.0.3 tar.gz https://github.com/winlibs/libjpeg/archive/refs/tags/libjpeg-turbo-${ver}.${ext}
libpng 1.6.53 tar.gz https://github.com/pnggroup/libpng/archive/refs/tags/v${ver}.${ext} zlib
libopus 1.6.1 tar.gz https://github.com/xiph/opus/archive/refs/tags/v${ver}.${ext}
librav1e 0.8.1 tar.gz https://github.com/xiph/rav1e/archive/refs/tags/v${ver}.${ext}
libdav1d 1.5.3 tar.xz https://downloads.videolan.org/videolan/dav1d/${ver}/dav1d-${ver}.${ext}
libbluray 1.4.1 tar.xz https://download.videolan.org/pub/videolan/libbluray/${ver}/libbluray-${ver}.${ext} libfontconfig,libfreetype,libxml2
libsnappy 1.2.2 tar.gz https://github.com/google/snappy/archive/refs/tags/${ver}.${ext}
libvorbis 1.3.7 tar.xz https://github.com/xiph/vorbis/releases/download/v${ver}/libvorbis-${ver}.${ext} libogg,cmake3
libmp3lame 3.100 tar.gz https://pilotfiber.dl.sourceforge.net/project/lame/lame/${ver}/lame-${ver}.${ext}
libfribidi 1.0.16 tar.xz https://github.com/fribidi/fribidi/releases/download/v${ver}/fribidi-${ver}.${ext}
libfreetype 2.14.1 tar.xz https://downloads.sourceforge.net/freetype/freetype-${ver}.${ext} bzip,libpng,zlib,brotli,libharfbuzzNFTP
libharfbuzz 12.3.0 tar.xz https://github.com/harfbuzz/harfbuzz/releases/download/${ver}/harfbuzz-${ver}.${ext} libfreetype
libopenjpeg 2.5.4 tar.gz https://github.com/uclouvain/openjpeg/archive/refs/tags/v${ver}.${ext} libtiff,lcms2
libsvtav1 4.1.0 tar.gz https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${ver}/SVT-AV1-v${ver}.${ext}
libsvtav1_hdr 4.1.0 tar.gz https://github.com/juliobbv-p/svt-av1-hdr/archive/refs/tags/v${ver}.${ext} dovi_tool,hdr10plus_tool,cpuinfo
libsvtav1_psy 3.0.2-B tar.gz https://github.com/BlueSwordM/svt-av1-psyex/archive/refs/tags/v${ver}.${ext} dovi_tool,hdr10plus_tool,cpuinfo
libfontconfig 2.17.1 tar.xz https://gitlab.freedesktop.org/api/v4/projects/890/packages/generic/fontconfig/${ver}/fontconfig-${ver}.${ext} libharfbuzz,expat,brotli
'
# dependencies
BUILDS_CONF+='
xz 5.8.2 tar.xz https://github.com/tukaani-project/xz/releases/download/v${ver}/xz-${ver}.${ext}
glad 2.0.8 tar.gz https://github.com/Dav1dde/glad/archive/refs/tags/v${ver}.${ext}
zlib 1.3.1 tar.gz https://github.com/madler/zlib/archive/refs/tags/v${ver}.${ext}
libdeflate 1.25 tar.gz https://github.com/ebiggers/libdeflate/archive/refs/tags/v${ver}.${ext} zlib
zstd 1.5.7 tar.gz https://github.com/facebook/zstd/archive/refs/tags/v${ver}.${ext}
libplacebo 7.351.0 tar.gz https://github.com/haasn/libplacebo/archive/refs/tags/v${ver}.${ext} glslang,vulkan_loader,glad
bzip master git https://github.com/libarchive/bzip2.git
expat 2.7.3 tar.xz https://github.com/libexpat/libexpat/releases/download/R_${ver//./_}/expat-${ver}.${ext}
brotli 1.2.0 tar.gz https://github.com/google/brotli/archive/refs/tags/v${ver}.${ext}
cmake3 3.31.8 tar.gz https://github.com/Kitware/CMake/archive/refs/tags/v${ver}.${ext}
libogg 1.3.6 tar.xz https://github.com/xiph/ogg/releases/download/v${ver}/libogg-${ver}.${ext}
libpng 1.6.53 tar.gz https://github.com/pnggroup/libpng/archive/refs/tags/v${ver}.${ext} zlib
libtiff 4.7.1 tar.gz https://github.com/libsdl-org/libtiff/archive/refs/tags/v${ver}.${ext} libwebp,libdeflate,xz,zstd
cpuinfo main git https://github.com/pytorch/cpuinfo/
libjpeg 3.0.3 tar.gz https://github.com/winlibs/libjpeg/archive/refs/tags/libjpeg-turbo-${ver}.${ext}
glslang 16.0.0 tar.gz https://github.com/KhronosGroup/glslang/archive/refs/tags/${ver}.${ext} spirv_tools
libnuma 2.0.19 tar.gz https://github.com/numactl/numactl/archive/refs/tags/v${ver}.${ext}
supmover 2.4.3 tar.gz https://github.com/MonoS/SupMover/archive/refs/tags/v${ver}.${ext}
dovi_tool 2.3.1 tar.gz https://github.com/quietvoid/dovi_tool/archive/refs/tags/${ver}.${ext}
libcrypto 3.6.1 tar.gz https://github.com/openssl/openssl/archive/refs/tags/openssl-${ver}.${ext} brotli,zlib,zstd
libdeflate 1.25 tar.gz https://github.com/ebiggers/libdeflate/archive/refs/tags/v${ver}.${ext} zlib
libunibreak 6.1 tar.gz https://github.com/adah1972/libunibreak/releases/download/libunibreak_${ver//./_}/libunibreak-${ver}.${ext}
spirv_tools 2025.4 tar.gz https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/v${ver}.${ext} spirv_headers
spirv_headers 1.4.328.1 tar.gz https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-${ver}.${ext}
glad 2.0.8 tar.gz https://github.com/Dav1dde/glad/archive/refs/tags/v${ver}.${ext}
libx265 4.1 tar.gz http://ftp.videolan.org/pub/videolan/x265/x265_${ver}.${ext} libnuma,cmake3
libnuma 2.0.19 tar.gz https://github.com/numactl/numactl/archive/refs/tags/v${ver}.${ext}
cmake3 3.31.8 tar.gz https://github.com/Kitware/CMake/archive/refs/tags/v${ver}.${ext}
libass 0.17.4 tar.xz https://github.com/libass/libass/releases/download/${ver}/libass-${ver}.${ext} libfontconfig,libfreetype,libharfbuzz,libfribidi,libunibreak,libxml2,xz
libfontconfig 2.17.1 tar.xz https://gitlab.freedesktop.org/api/v4/projects/890/packages/generic/fontconfig/${ver}/fontconfig-${ver}.${ext} libharfbuzz,expat,brotli
libfreetype 2.14.1 tar.xz https://downloads.sourceforge.net/freetype/freetype-${ver}.${ext} bzip,libpng,zlib,brotli,libharfbuzzNFTP
hdr10plus_tool 1.7.2 tar.gz https://github.com/quietvoid/hdr10plus_tool/archive/refs/tags/${ver}.${ext}
libharfbuzzNFTP 12.3.0 tar.xz https://github.com/harfbuzz/harfbuzz/releases/download/${ver}/harfbuzz-${ver}.${ext}
libharfbuzz 12.3.0 tar.xz https://github.com/harfbuzz/harfbuzz/releases/download/${ver}/harfbuzz-${ver}.${ext} libfreetype
libunibreak 6.1 tar.gz https://github.com/adah1972/libunibreak/releases/download/libunibreak_${ver//./_}/libunibreak-${ver}.${ext}
libxml2 2.15.1 tar.gz https://github.com/GNOME/libxml2/archive/refs/tags/v${ver}.${ext}
xz 5.8.2 tar.xz https://github.com/tukaani-project/xz/releases/download/v${ver}/xz-${ver}.${ext}
libfribidi 1.0.16 tar.xz https://github.com/fribidi/fribidi/releases/download/v${ver}/fribidi-${ver}.${ext}
bzip latest git https://github.com/libarchive/bzip2.git
brotli 1.2.0 tar.gz https://github.com/google/brotli/archive/refs/tags/v${ver}.${ext}
expat 2.7.3 tar.xz https://github.com/libexpat/libexpat/releases/download/R_${ver//./_}/expat-${ver}.${ext}
supmover 2.4.3 tar.gz https://github.com/MonoS/SupMover/archive/refs/tags/v${ver}.${ext}
'
# ffmpeg --enable that are not added to DEFAULT_ENABLE (WIP)
BUILDS_CONF+='
libssh 0.11.1 tar.gz https://github.com/canonical/libssh/archive/refs/tags/libssh-${ver}.${ext} libcrypto
libplacebo 7.351.0 tar.gz https://github.com/haasn/libplacebo/archive/refs/tags/v${ver}.${ext} glslang,vulkan_loader,glad
'
local supported_builds=()
unset ver ext url deps extractedDir
@@ -398,9 +405,11 @@ supmover 2.4.3 tar.gz https://github.com/MonoS/SupMover/archi
supported_builds+=("${build}")
# padding support
longestBuild="$(fb_max "${#build}" "${longestBuild}")"
longestVer="$(fb_max "${#ver}" "${longestVer}")"
longestExt="$(fb_max "${#ext}" "${longestExt}")"
if [[ ${getBuild} == 'formatted' ]]; then
longestBuild="$(fb_max "${#build}" "${longestBuild}")"
longestVer="$(fb_max "${#ver}" "${longestVer}")"
longestExt="$(fb_max "${#ext}" "${longestExt}")"
fi
if [[ ${getBuild} != "${build}" ]]; then
build=''
@@ -447,11 +456,9 @@ supmover 2.4.3 tar.gz https://github.com/MonoS/SupMover/archi
# shellcheck disable=SC2206
deps=(${deps//,/ })
fi
# set version based off of remote head
# and set extracted directory
# set extracted directory
if [[ ${ext} == 'git' ]]; then
ver="$(get_remote_head "${url}")"
extractedDir="${BUILD_DIR}/${build}-${ext}"
extractedDir="${BUILD_DIR}/${build}-${ext}-${ver}"
else
extractedDir="${BUILD_DIR}/${build}-v${ver}"
fi
@@ -521,12 +528,15 @@ download_release() {
else
# for git downloads
test -d "${download}" ||
git clone --depth 1 --recursive "${url}" "${download}" || return 1
git clone \
--branch "${ver}" \
--depth 1 \
--recursive "${url}" "${download}" || return 1
(
cd "${download}" || exit 1
local localHEAD remoteHEAD
localHEAD="$(git rev-parse HEAD)"
remoteHEAD="$(get_remote_head "${url}")"
remoteHEAD="$(get_remote_head "${url}" "${build}" "${ver}")"
if [[ ${localHEAD} != "${remoteHEAD}" ]]; then
git stash
git pull --ff-only
@@ -682,11 +692,11 @@ build() {
# skip packaging on PGO generate run
if [[ ${PGO} == 'ON' && ${PGO_RUN} == 'generate' ]]; then
PATH="${PREFIX}/bin:${PATH}" gen_profdata
PATH="${BINDIR}:${PATH}" gen_profdata
return $?
fi
local ffmpegBin="${PREFIX}/bin/ffmpeg"
local ffmpegBin="${BINDIR}/ffmpeg"
# run ffmpeg to show completion
"${ffmpegBin}" -version || return 1
@@ -695,9 +705,10 @@ build() {
local ffmpeg="$(command -v ffmpeg 2>/dev/null)"
if [[ ${ffmpeg} != "${ffmpegBin}" ]]; then
echo
echo_warn "ffmpeg in path (${ffmpeg}) is not the built one (${ffmpegBin})"
echo_info "consider adding ${PREFIX}/bin to \$PATH"
echo "echo 'export PATH=\"${PREFIX}/bin:\$PATH\"' >> ~/.bashrc"
echo_warn "ffmpeg in PATH (${ffmpeg}) is not the built one (${ffmpegBin})"
local homeAwareBin="${BINDIR//${HOME}/\$HOME}"
echo_info "consider adding ${homeAwareBin} to \$PATH"
echo "echo 'export PATH=\"${homeAwareBin}:\$PATH\"' >> ~/.bashrc"
fi
package || return 1
@@ -714,6 +725,11 @@ sanitize_sysroot_libs() {
local libs=("$@")
if [[ -z ${USE_LIB_SUFF} || -z ${DEL_LIB_SUFF} ]]; then
echo_fail "{USE,DEL}_LIB_SUFF not defined"
return 1
fi
for lib in "${libs[@]}"; do
local libPath="${LIBDIR}/${lib}"
local foundLib=false
@@ -1002,7 +1018,6 @@ build_cmake3() (
fi
CMAKE_FLAGS+=(
"-DCMAKE_PREFIX_PATH=${LOCAL_PREFIX}"
"-DCMAKE_INSTALL_PREFIX=${LOCAL_PREFIX}"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_BUILD_TYPE=Release"
@@ -1052,6 +1067,46 @@ build_expat() {
sanitize_sysroot_libs libexpat || return 1
}
build_libsnappy() {
local modCxx
modCxx="$(get_cmake_flag CMAKE_CXX_FLAGS "${CMAKE_FLAGS[@]}")" || return 1
if [[ ${PGO} == 'ON' ]]; then
# libsnappy fails PGO for some reason
modCxx+=" -Wno-backend-plugin"
fi
meta_cmake_build \
-DCMAKE_CXX_FLAGS="${modCxx}" \
-DSNAPPY_BUILD_TESTS=OFF \
-DSNAPPY_BUILD_BENCHMARKS=OFF || return 1
sanitize_sysroot_libs libsnappy || return 1
}
build_libssh() {
meta_cmake_build || return 1
sanitize_sysroot_libs libssh || return 1
}
build_libjxl() {
# jxl headers interfere with this build
recreate_dir "${INCDIR}/jxl" || return 1
meta_cmake_build \
-DJPEGXL_ENABLE_JNI=OFF \
-DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
-DJPEGXL_BUNDLE_LIBPNG=OFF || return 1
local libs=(
libjxl
libjxl_cms
libjxl_threads
)
if [[ ${STATIC} == ON ]]; then
libs+=(libjxl_extras_codec)
fi
sanitize_sysroot_libs "${libs[@]}" || return 1
}
### MESON ###
meta_meson_build() {
local addFlags=("$@")
@@ -1169,6 +1224,12 @@ build_lcms2() {
sanitize_sysroot_libs liblcms2 || return 1
}
build_libbluray() {
meta_meson_build \
-D enable_tools=false || return 1
sanitize_sysroot_libs libbluray || return 1
}
### PYTHON ###
build_glad() {
true
@@ -1270,6 +1331,29 @@ build_libass() {
sanitize_sysroot_libs libass || return 1
}
build_libcrypto() {
local cryptoFlags=()
if [[ ${STATIC} == 'OFF' ]]; then
cryptoFlags+=(no-shared)
fi
cryptoFlags+=(
enable-{brotli,zlib,zstd}
--with-{brotli,zlib,zstd}-include="${INCDIR}"
--with-{brotli,zlib,zstd}-lib="${LIBDIR}"
)
cp Configure configure
(
unset CONFIGURE_FLAGS
meta_configure_build \
--prefix="${PREFIX}" \
--libdir=lib \
"${cryptoFlags[@]}"
) || return 1
sanitize_sysroot_libs libcrypto libssl || return 1
}
add_project_versioning_to_ffmpeg() {
# embed this project's enables/versions
# into ffmpeg with FFMPEG_BUILDER_INFO
@@ -1302,13 +1386,6 @@ build_ffmpeg() {
# libsvtav1_* patch and enable name change
for enable in ${ENABLE}; do
if line_starts_with "${enable}" libsvtav1; then
# libsvtav1 v4 is breaking API
if [[ "$(get_build_conf "${enable}" ver)" == '4'* ]]; then
replace_line \
libavcodec/libsvtav1.c \
'param->enable_adaptive_quantization = 0;' \
'param->aq_mode = 0;' || return 1
fi
enable=libsvtav1
fi
CONFIGURE_FLAGS+=("--enable-${enable}")
@@ -1346,7 +1423,7 @@ build_ffmpeg() {
meta_configure_build \
"${ffmpegFlags[@]}" || return 1
LTO="${ltoBackup}"
${SUDO_MODIFY} cp ff*_g "${PREFIX}/bin"
${SUDO_MODIFY} cp ff*_g "${BINDIR}"
sanitize_sysroot_libs \
libavcodec libavdevice libavfilter libswscale \
libavformat libavutil libswresample || return 1
+33 -26
View File
@@ -7,49 +7,56 @@
unset FB_COMP_OPTS_DESC
declare -Ag FB_COMP_OPTS_DESC
# default compile options
FB_COMP_OPTS_DESC['CLEAN']='clean build directories before building'
# default build options
FB_COMP_OPTS_DESC['CLEAN']='clean build directories before building (ON/OFF)'
DEFAULT_CLEAN=ON
FB_COMP_OPTS_DESC['LTO']='enable link time optimization'
FB_COMP_OPTS_DESC['LTO']='enable link time optimization (ON/OFF)'
DEFAULT_LTO=ON
FB_COMP_OPTS_DESC['PGO']='enable profile guided optimization'
FB_COMP_OPTS_DESC['PGO']='enable profile guided optimization (ON/OFF)'
DEFAULT_PGO=OFF
FB_COMP_OPTS_DESC['OPT']='optimization level (0-3)'
DEFAULT_OPT=3
FB_COMP_OPTS_DESC['STATIC']='static or shared build'
FB_COMP_OPTS_DESC['STATIC']='static (ON) or shared (OFF) build'
DEFAULT_STATIC=ON
FB_COMP_OPTS_DESC['ARCH']='architecture type (x86-64-v{1,2,3,4}, armv8-a, etc)'
DEFAULT_ARCH=native
FB_COMP_OPTS_DESC['PREFIX']='prefix to install to, default is local install in ./gitignore/sysroot'
FB_COMP_OPTS_DESC['PREFIX']='path to install to, local install is in ./gitignore/sysroot'
DEFAULT_PREFIX='local'
FB_COMP_OPTS_DESC['PACKAGE']='package ffmpeg binaries to tarball in ./gitignore/package (ON/OFF)'
DEFAULT_PACKAGE=OFF
FB_COMP_OPTS_DESC['ENABLE']='configure what ffmpeg enables'
DEFAULT_ENABLE="\
libaom \
libass \
libvpx \
libxml2 \
libvmaf \
libx264 \
libx265 \
libwebp \
libopus \
librav1e \
libdav1d \
libvorbis \
libmp3lame \
libfribidi \
libfreetype \
libharfbuzz \
libopenjpeg \
libsvtav1_hdr \
libfontconfig \
DEFAULT_ENABLE="
lcms2
libaom
libass
libvpx
libjxl
libxml2
libvmaf
libx264
libx265
libwebp
libopus
librav1e
libdav1d
libbluray
libsnappy
libvorbis
libmp3lame
libfribidi
libfreetype
libharfbuzz
libopenjpeg
libsvtav1_hdr
libfontconfig
"
# user-overridable compile option variable names
+80 -61
View File
@@ -2,99 +2,114 @@
efg_usage() {
echo "efg -i input [options]"
echo -e "\t[-P NUM] set preset (default: ${PRESET})"
echo -e "\t[-l NUM] low value (default: ${LOW})"
echo -e "\t[-s NUM] step value (default: ${STEP})"
echo -e "\t[-h NUM] high value (default: ${HIGH})"
echo -e "\t[-p] plot bitrates using gnuplot"
echo -e "\n\t[-I] system install at ${EFG_INSTALL_PATH}"
echo -e "\t[-U] uninstall from ${EFG_INSTALL_PATH}"
print_opt_map "${EFG_OPT_MAP[@]}" || return 1
return 0
}
set_efg_opts() {
local opts='P:pl:s:h:i:IU'
local numOpts=${#opts}
# default values
unset INPUT
PRESET=10
LOW=0
STEP=1
HIGH=30
PLOT=false
ENCODE_SEGMENTS=5
EFG_INSTALL_PATH='/usr/local/bin/efg'
local EFG_OPT_MAP=(
"-i --input input file"
"-P --preset set preset (default: ${PRESET})"
"-l --low set low end value for grain range (default: ${LOW})"
"-s --step set step value for grain range (default: ${STEP})"
"-h --high set high end value for grain range (default: ${HIGH})"
"-n --segments number of segments to analyze from input (default: ${ENCODE_SEGMENTS})"
"-p --plot plot bitrates using gnuplot"
"-I --install system install at ${EFG_INSTALL_PATH}"
"-U --uninstall uninstall from ${EFG_INSTALL_PATH}"
)
# only using -I or -U
local minOpt=1
# using all
local maxOpt=${numOpts}
test $# -lt ${minOpt} && efg_usage && return 1
test $# -gt ${maxOpt} && efg_usage && return 1
local OPTARG OPTIND
while getopts "${opts}" flag; do
case "${flag}" in
P)
if ! is_positive_integer "${OPTARG}"; then
local arg value
while [[ $# -gt 0 ]]; do
arg="$1"
value="${2:-}"
case "${arg}" in
-i | --input)
INPUT="${value}"
shift
;;
-P | --preset)
if ! is_positive_integer "${value}"; then
efg_usage
return 1
fi
PRESET="${OPTARG}"
PRESET="${value}"
shift
;;
I)
-l | --low)
if ! is_positive_integer "${value}"; then
efg_usage
return 1
fi
LOW="${value}"
shift
;;
-s | --step)
if ! is_positive_integer "${value}"; then
efg_usage
return 1
fi
STEP="${value}"
shift
;;
-h | --high)
if ! is_positive_integer "${value}"; then
efg_usage
return 1
fi
HIGH="${value}"
shift
;;
-n | --num-segments)
if ! is_positive_integer "${value}"; then
efg_usage
return 1
fi
ENCODE_SEGMENTS="${value}"
shift
;;
-p | --plot)
missing_cmd gnuplot && return 1
PLOT=true
;;
-I | --install)
echo_warn "attempting install"
sudo ln -sf "${SCRIPT_DIR}/efg.sh" \
"${EFG_INSTALL_PATH}" || return 1
echo_pass "succesfull install"
return ${FUNC_EXIT_SUCCESS}
return "${FUNC_EXIT_SUCCESS}"
;;
U)
-U | --uninstall)
echo_warn "attempting uninstall"
sudo rm "${EFG_INSTALL_PATH}" || return 1
echo_pass "succesfull uninstall"
return ${FUNC_EXIT_SUCCESS}
;;
i)
if [[ $# -lt 2 ]]; then
echo_fail "wrong arguments given"
efg_usage
return 1
fi
INPUT="${OPTARG}"
;;
p)
missing_cmd gnuplot && return 1
PLOT=true
;;
l)
if ! is_positive_integer "${OPTARG}"; then
efg_usage
return 1
fi
LOW="${OPTARG}"
;;
s)
if ! is_positive_integer "${OPTARG}"; then
efg_usage
return 1
fi
STEP="${OPTARG}"
;;
h)
if ! is_positive_integer "${OPTARG}"; then
efg_usage
return 1
fi
HIGH="${OPTARG}"
return "${FUNC_EXIT_SUCCESS}"
;;
*)
echo "wrong flags given"
echo_fail "unsupported option: [${arg}]"
efg_usage
return 1
;;
esac
shift
done
if [[ ! -f ${INPUT} ]]; then
echo "${INPUT} does not exist"
# validate input
if [[ -z ${INPUT} || ! -f ${INPUT} ]]; then
echo_fail "input undefined or does not exist"
efg_usage
return 1
fi
@@ -108,7 +123,7 @@ set_efg_opts() {
EFG_DIR+="-${sanitizedInput}"
echo_info "estimating film grain for ${INPUT}"
echo_info "range: $LOW-$HIGH with $STEP step increments"
echo_info "range: ${LOW}-${HIGH} with ${STEP} step increments"
}
efg_segment() {
@@ -255,9 +270,13 @@ FB_FUNC_NAMES+=('efg')
# shellcheck disable=SC2034
FB_FUNC_DESCS['efg']='estimate the film grain of a given file'
efg() {
# localize variables used by child functions
local PRESET LOW STEP HIGH PLOT \
EFG_INSTALL_PATH EFG_DIR ENCODE_SEGMENTS \
GRAIN_LOG
EFG_DIR="${TMP_DIR}/efg"
# encode N highest-bitrate segments
ENCODE_SEGMENTS=5
set_efg_opts "$@"
local ret=$?
+112 -108
View File
@@ -64,7 +64,7 @@ set_subtitle_params() {
local convertCodec='eia_608'
local defaultTextCodec
if [[ ${SAME_CONTAINER} == false && ${FILE_EXT} == 'mkv' ]]; then
if [[ ${SAME_CONTAINER} == false && ${OUTPUT} == *'.mkv' ]]; then
defaultTextCodec='srt'
convertCodec+='|mov_text'
else
@@ -324,19 +324,10 @@ setup_pgs_mkv() {
}
encode_usage() {
echo "encode -i input [options] output"
echo -e "\t[-P NUM] set preset (default: ${PRESET})"
echo -e "\t[-C NUM] set CRF (default: ${CRF})"
echo -e "\t[-g NUM] set film grain for encode"
echo -e "\t[-p] print the command instead of executing it (default: ${PRINT_OUT})"
echo -e "\t[-c] use cropdetect (default: ${CROP})"
echo -e "\t[-d] enable dolby vision (default: ${DV_TOGGLE})"
echo -e "\t[-v] print relevant version info"
echo -e "\t[-s] use same container as input, default is convert to mkv"
echo -e "\n\t[output] if unset, defaults to \${PWD}/av1-input-file-name.mkv"
echo -e "\n\t[-u] update script (git pull ffmpeg-builder)"
echo -e "\t[-I] system install at ${ENCODE_INSTALL_PATH}"
echo -e "\t[-U] uninstall from ${ENCODE_INSTALL_PATH}"
echo "encode -i input [options] [output]"
print_opt_map "${ENCODE_OPT_MAP[@]}" || return 1
echo -e "\n [output] output filename (default: \${PWD}/av1-input-file-name.mkv)\n"
return 0
}
@@ -345,138 +336,146 @@ encode_update() {
}
set_encode_opts() {
local opts='vi:pcsdg:P:C:uIU'
local numOpts=${#opts}
# default values
PRESET=3
CRF=25
GRAIN=""
GRAIN=''
CROP=false
PRINT_OUT=false
DV_TOGGLE=false
ENCODE_INSTALL_PATH='/usr/local/bin/encode'
SAME_CONTAINER="false"
local ENCODE_OPT_MAP=(
"-i --input input file"
"-P --preset set preset (default: ${PRESET})"
"-C --crf set CRF (default: ${CRF})"
"-g --grain set film grain (default: disabled)"
"-p --print print the script instead of executing it"
"-c --crop use crop detect to auto-crop"
"-d --dv enable dolby vision"
"-v --version print version info"
"-s --same-container use same container as input (default: mkv)"
"-u --update update script (git pull ffmpeg-builder)"
"-I --install system install at ${ENCODE_INSTALL_PATH}"
"-U --uninstall uninstall from ${ENCODE_INSTALL_PATH}"
)
# only using -I/U
local minOpt=1
# using all + output name
local maxOpt=$((numOpts + 1))
test $# -lt ${minOpt} && encode_usage && return 1
test $# -gt ${maxOpt} && encode_usage && return 1
local optsUsed=0
local OPTARG OPTIND
while getopts "${opts}" flag; do
case "${flag}" in
u)
encode_update || return 1
return ${FUNC_EXIT_SUCCESS}
local arg value
while [[ $# -gt 0 ]]; do
arg="$1"
value="${2:-}"
case "${arg}" in
-i | --input)
INPUT="${value}"
shift
;;
I)
-P | --preset)
if ! is_positive_integer "${value}"; then
encode_usage
return 1
fi
PRESET="${value}"
shift
;;
-C | --crf)
if ! is_positive_integer "${value}" || test "${value}" -gt 63; then
echo_fail "${value} is not a valid CRF value (0-63)"
encode_usage
return 1
fi
CRF="${value}"
shift
;;
-g | --grain)
if ! is_positive_integer "${value}"; then
encode_usage
return 1
fi
GRAIN="film-grain=${value}:film-grain-denoise=1:adaptive-film-grain=1:"
shift
;;
-c | --crop)
CROP=true
;;
-p | --print)
PRINT_OUT=true
;;
-d | --dv)
DV_TOGGLE=true
;;
-v | --version)
get_encode_versions print || return 1
return "${FUNC_EXIT_SUCCESS}"
;;
-s | --same-container)
SAME_CONTAINER=true
;;
-u | --update)
encode_update || return 1
return "${FUNC_EXIT_SUCCESS}"
;;
-I | --install)
echo_warn "attempting install"
sudo ln -sf "${SCRIPT_DIR}/encode.sh" \
"${ENCODE_INSTALL_PATH}" || return 1
echo_pass "succesfull install"
return ${FUNC_EXIT_SUCCESS}
return "${FUNC_EXIT_SUCCESS}"
;;
U)
-U | --uninstall)
echo_warn "attempting uninstall"
sudo rm "${ENCODE_INSTALL_PATH}" || return 1
echo_pass "succesfull uninstall"
return ${FUNC_EXIT_SUCCESS}
;;
v)
get_encode_versions print || return 1
return ${FUNC_EXIT_SUCCESS}
;;
i)
if [[ $# -lt 2 ]]; then
echo_fail "wrong arguments given"
encode_usage
return 1
fi
INPUT="${OPTARG}"
optsUsed=$((optsUsed + 2))
;;
p)
PRINT_OUT=true
optsUsed=$((optsUsed + 1))
;;
c)
CROP=true
optsUsed=$((optsUsed + 1))
;;
d)
DV_TOGGLE=true
optsUsed=$((optsUsed + 1))
;;
s)
SAME_CONTAINER=true
optsUsed=$((optsUsed + 1))
;;
g)
if ! is_positive_integer "${OPTARG}"; then
encode_usage
return 1
fi
GRAIN="film-grain=${OPTARG}:film-grain-denoise=1:adaptive-film-grain=1:"
optsUsed=$((optsUsed + 2))
;;
P)
if ! is_positive_integer "${OPTARG}"; then
encode_usage
return 1
fi
PRESET="${OPTARG}"
optsUsed=$((optsUsed + 2))
;;
C)
if ! is_positive_integer "${OPTARG}" || test ${OPTARG} -gt 63; then
echo_fail "${OPTARG} is not a valid CRF value (0-63)"
encode_usage
return 1
fi
CRF="${OPTARG}"
OPTS_USED=$((OPTS_USED + 2))
return "${FUNC_EXIT_SUCCESS}"
;;
*)
echo_fail "wrong flags given"
encode_usage
return 1
# OUTPUT will be the last (optional) arg
if [[ $# -ne 1 ]]; then
echo_fail "unsupported option: [${arg}]"
encode_usage
return 1
fi
OUTPUT="${arg}"
;;
esac
shift
done
# allow optional output filename
if [[ $(($# - optsUsed)) == 1 ]]; then
OUTPUT="${*: -1}"
else
local basename="$(bash_basename "${INPUT}")"
# validate input
if [[ -z ${INPUT} || ! -f ${INPUT} ]]; then
echo_fail "input undefined or does not exist"
encode_usage
return 1
fi
# fallback output path
if [[ -z ${OUTPUT} ]]; then
local basename
basename="$(bash_basename "${INPUT}")" || return 1
OUTPUT="${PWD}/av1-${basename}"
fi
# use same container for output
if [[ $SAME_CONTAINER == "true" ]]; then
local fileFormat
if [[ ${SAME_CONTAINER} == true ]]; then
local fileFormat outputSuffix
fileFormat="$(get_file_format "${INPUT}")" || return 1
FILE_EXT=''
if [[ ${fileFormat} == 'MPEG-4' ]]; then
FILE_EXT='mp4'
outputSuffix='mp4'
elif [[ ${fileFormat} == 'Matroska' ]]; then
FILE_EXT='mkv'
outputSuffix='mkv'
else
echo "unrecognized input format"
echo_fail "unrecognized input format"
return 1
fi
else
FILE_EXT="mkv"
outputSuffix='mkv'
fi
OUTPUT="${OUTPUT%.*}"
OUTPUT+=".${FILE_EXT}"
if [[ ! -f ${INPUT} ]]; then
echo "${INPUT} does not exist"
encode_usage
return 1
fi
OUTPUT+=".${outputSuffix}"
if [[ ${PRINT_OUT} == false ]]; then
echo
@@ -658,7 +657,7 @@ gen_encode_script() {
echo 'ffmpeg "${ffmpegParams[@]}" -dolbyvision 0 "${OUTPUT}" || exit 1'
# track-stats and clear title
if [[ ${FILE_EXT} == 'mkv' ]]; then
if [[ ${OUTPUT} == *'.mkv' ]]; then
{
# ffmpeg does not copy PGS subtitles without breaking them
# use mkvmerge to extract and supmover to crop
@@ -690,6 +689,11 @@ FB_FUNC_NAMES+=('encode')
# shellcheck disable=SC2034
FB_FUNC_DESCS['encode']='encode a file using libsvtav1 and libopus'
encode() {
# localize variables used by child functions
local PRESET CRF GRAIN CROP PRINT_OUT \
DV_TOGGLE ENCODE_INSTALL_PATH SAME_CONTAINER \
INPUT OUTPUT
set_encode_opts "$@"
local ret=$?
if [[ ${ret} -eq ${FUNC_EXIT_SUCCESS} ]]; then
+2 -2
View File
@@ -51,8 +51,8 @@ get_crop() {
duration="$(get_duration "${file}")" || return 1
# don't care about decimal points
IFS='.' read -r duration _ <<<"${duration}"
# get crop value for first half of input
local timeEnc=$((duration / 20))
# get crop value for first tenth of input
local timeEnc=$((duration / 10))
ffmpeg \
-y \
-hide_banner \
+6 -13
View File
@@ -2,14 +2,6 @@
# shellcheck disable=SC2120
determine_pkg_mgr() {
# sudo used externally
# shellcheck disable=SC2034
if is_windows || test "$(id -u)" -eq 0; then
SUDO=''
else
SUDO='sudo '
fi
# pkg-mgr update-cmd upgrade-cmd install-cmd check-cmd
# shellcheck disable=SC2016
local PKG_MGR_MAP='
@@ -178,15 +170,16 @@ check_for_req_pkgs() {
if missing_cmd rustup; then
echo_warn "installing rustup"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# shellcheck disable=SC2016
grep -q 'source "${HOME}/.cargo/env"' "${HOME}/.bashrc" ||
echo 'source "${HOME}/.cargo/env"' >>"${HOME}/.bashrc"
# shellcheck disable=SC1091
fi
if missing_cmd cargo; then
source "${HOME}/.bashrc"
fi
fi
has_cmd cargo-cbuild || echo_if_fail cargo install cargo-c || return 1
if ! has_cmd cargo-cbuild; then
echo_info "installing cargo-c"
echo_if_fail cargo install cargo-c || return 1
fi
echo_pass "cargo-c is installed"
echo_pass "all required packages installed"
+1 -3
View File
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
check_for_package_cfg() {
local requiredCfg='ON:ON:ON:3'
local currentCfg="${STATIC}:${LTO}:${PGO}:${OPT}"
if [[ ${currentCfg} == "${requiredCfg}" ]]; then
if [[ ${PACKAGE} == 'ON' ]]; then
return 0
else
return 1
+3 -3
View File
@@ -14,7 +14,7 @@ gen_function_info() {
gen_compile_opts_info() {
for opt in "${FB_COMP_OPTS[@]}"; do
declare -n defOptVal="DEFAULT_${opt}"
echo "- \`${opt}\`: ${FB_COMP_OPTS_DESC[${opt}]} (default: ${defOptVal})"
echo "- \`${opt}\`: ${FB_COMP_OPTS_DESC[${opt}]}. default: ${defOptVal}"
done
}
@@ -70,11 +70,11 @@ ENABLE='libdav1d' ./scripts/docker_run_image.sh ubuntu ./scripts/build.sh
# Encoding scripts
The encoding scripts are designed to be installed to system paths for re-use via symbolic links back to this repo using the \`-I\` flag.
## Encoding with svtav1-psy and opus
## Encoding with svtav1 and opus
\`\`\`bash
$(encode)
\`\`\`
- Uses svtav1-psy for the video encoder.
- Uses svtav1 for the video encoder.
- Uses libopus for the audio encoder.
- Skips re-encoding av1/opus streams.
- Only maps audio streams that match the video stream language if the video stream has a defined language.
+3 -3
View File
@@ -78,7 +78,7 @@ export REPO_DIR="$(cd "$(dirname "${thisFile}")/.." && echo "$PWD")"
source "${REPO_DIR}/main.sh" || exit 1
scr_name="$(bash_basename $0)"
cmd="${scr_name//.sh/}"
if [[ $DEBUG == 1 ]]; then set -x; fi
[[ ${DEBUG} == 1 ]] && set -x
$cmd "$@"' >"${ENTRY_SCRIPT}"
chmod +x "${ENTRY_SCRIPT}"
for funcName in "${FB_FUNC_NAMES[@]}"; do
@@ -89,7 +89,7 @@ $cmd "$@"' >"${ENTRY_SCRIPT}"
gen_links || return 1
# allow calling entry.sh with arguments as execution
entry() { "$@" ; }
entry() { "$@"; }
set_completions() {
for funcName in "${FB_FUNC_NAMES[@]}"; do
@@ -97,7 +97,7 @@ set_completions() {
done
}
determine_pkg_mgr || return 1
set_sudo || return 1
check_compile_opts_override || return 1
# set local prefix since some functions need it
@@ -0,0 +1,39 @@
diff --git a/src/libbluray/disc/dec.c b/src/libbluray/disc/dec.c
index feb91db..91b0b07 100644
--- a/src/libbluray/disc/dec.c
+++ b/src/libbluray/disc/dec.c
@@ -284,7 +284,7 @@ static void _dec_load(BD_DEC *dec, BD_ENC_INFO *i)
*
*/
-BD_DEC *dec_init(struct dec_dev *dev, BD_ENC_INFO *enc_info,
+BD_DEC *libbluray_dec_init(struct dec_dev *dev, BD_ENC_INFO *enc_info,
const char *keyfile_path,
void *regs, void *psr_read, void *psr_write)
{
diff --git a/src/libbluray/disc/dec.h b/src/libbluray/disc/dec.h
index d1329be..18550bf 100644
--- a/src/libbluray/disc/dec.h
+++ b/src/libbluray/disc/dec.h
@@ -45,7 +45,7 @@ struct dec_dev {
typedef struct bd_dec BD_DEC;
-BD_PRIVATE BD_DEC *dec_init(struct dec_dev *dev,
+BD_PRIVATE BD_DEC *libbluray_dec_init(struct dec_dev *dev,
struct bd_enc_info *enc_info,
const char *keyfile_path,
void *regs, void *psr_read, void *psr_write);
diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c
index 887296b..0267814 100644
--- a/src/libbluray/disc/disc.c
+++ b/src/libbluray/disc/disc.c
@@ -348,7 +348,7 @@ BD_DISC *disc_open(const char *device_path,
}
struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path };
- p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
+ p->dec = libbluray_dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
return p;
}
@@ -0,0 +1,12 @@
diff --git a/lib/threads/libjxl_threads.pc.in b/lib/threads/libjxl_threads.pc.in
index dfbaa3f..2c7bfe8 100644
--- a/lib/threads/libjxl_threads.pc.in
+++ b/lib/threads/libjxl_threads.pc.in
@@ -8,6 +8,6 @@ Description: JPEG XL multi-thread runner using std::threads.
Version: @JPEGXL_LIBRARY_VERSION@
@JPEGXL_REQUIRES_TYPE@: @JPEGXL_THREADS_LIBRARY_REQUIRES@
Libs: -L${libdir} -ljxl_threads
-Libs.private: -lm
+Libs.private: -lm @PKGCONFIG_CXX_LIB@
Cflags: -I${includedir}
Cflags.private: -DJXL_THREADS_STATIC_DEFINE
@@ -0,0 +1,11 @@
diff --git a/libssh.pc.cmake b/libssh.pc.cmake
index f288b94..438ca38 100644
--- a/libssh.pc.cmake
+++ b/libssh.pc.cmake
@@ -6,5 +6,5 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: @PROJECT_NAME@
Description: The SSH Library
Version: @PROJECT_VERSION@
-Libs: -L${libdir} -lssh
+Libs: -L${libdir} -lssh -lcrypto -lz
Cflags: -I${includedir}