From d33ebc6876cd55056ae48fdffdbeee01f9c54709 Mon Sep 17 00:00:00 2001 From: Alex <15526962+AlexPresso@users.noreply.github.com> Date: Thu, 18 May 2023 22:42:06 +0200 Subject: [PATCH] ffmpeg version selector (#70) * Add -v flag --- README.md | 4 +++- ffmpeg-wrapper.sh | 2 +- patcher.sh | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b899273..a34159d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Huge thanks to [Benjamin Poncet](https://github.com/BenjaminPoncet), [Vincent Fo ## Dependencies - DSM 6.2.2-24922 Update 4 (and above) - Video Station 2.4.6-1594 (and above) -- SynoCommunity ffmpeg 4.x.x ([help](https://synocommunity.com/#easy-install)) ⚠️ ffmpeg5 and ffmpeg6 cannot be used with VideoStation for now. +- SynoCommunity ffmpeg 4.x.x, ffmpeg 5.x.x or ffmpeg 6.x.x ([help](https://synocommunity.com/#easy-install)) ## Supported / Unsupported scenarios - **[DTS or EAC3 or TrueHD] + [Any non HEVC standard video format]**: ✅ @@ -27,6 +27,7 @@ Huge thanks to [Benjamin Poncet](https://github.com/BenjaminPoncet), [Vincent Fo - Connect to your NAS using SSH (admin user required) ([help](https://www.synology.com/en-global/knowledgebase/DSM/tutorial/General_Setup/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet)) - Use the command `sudo -i` to switch to root user - Use the [following](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#usage) command (Basic command) to execute the patch + - Note : Basic command uses **ffmpeg4** by default, if you want to use a different ffmpeg version (i.e. **ffmpeg5** or **ffmpeg6**, please check the command [flags](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#usage). - You'll have to re-run the patcher everytime you update VideoStation, Advanced Media Extensions and DSM ## Usage @@ -40,3 +41,4 @@ With options: | -a | No | Action flag: choose between `patch` or `unpatch` ; example: `-a patch` | patch | | -b | No | Branch flag: allows you to choose the wrapper branch to use ; example `-b main` | main | | -p | No | Proxy flag: allows you to use a proxy to connect to github ; example `-p http://my-proxy` | https://github.com | +| -v | No | FFMpeg version flag: allows you to choose desired ffmpeg version ; example `-v 5` | `4` | diff --git a/ffmpeg-wrapper.sh b/ffmpeg-wrapper.sh index 6c748d2..6e775a7 100644 --- a/ffmpeg-wrapper.sh +++ b/ffmpeg-wrapper.sh @@ -50,6 +50,6 @@ newline info "========================================[start ffmpeg $pid]" info "DEFAULT_ARGS: $*" -/var/packages/ffmpeg/target/bin/ffmpeg "$@" 2> $stderrfile +/var/packages/@ffmpeg_version@/target/bin/ffmpeg "$@" 2> $stderrfile endprocess diff --git a/patcher.sh b/patcher.sh index 4a06797..ead1911 100755 --- a/patcher.sh +++ b/patcher.sh @@ -10,7 +10,7 @@ repo_base_url="https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher" version="2.0" action="patch" branch="main" -dependencies=("VideoStation" "ffmpeg") +ffmpegversion="" wrappers=("ffmpeg") vs_path=/var/packages/VideoStation/target @@ -114,6 +114,9 @@ function patch() { done fi + info "Setting ffmpeg version to: ffmpeg$ffmpegversion" + sed -i -e "s/@ffmpeg_version@/ffmpeg$ffmpegversion/" "$vs_path/bin/ffmpeg" + info "Saving current libsynovte.so as libsynovte.so.orig" cp -n "$libsynovte_path" "$libsynovte_path.orig" chown VideoStation:VideoStation "$libsynovte_path.orig" @@ -157,15 +160,22 @@ function unpatch() { root_check check_dependencies -while getopts a:b:p: flag; do +while getopts a:b:p:v: flag; do case "${flag}" in a) action=${OPTARG};; b) branch=${OPTARG};; p) repo_base_url="${OPTARG}/AlexPresso/VideoStation-FFMPEG-Patcher";; - *) echo "usage: $0 [-a patch|unpatch] [-b branch] [-p http://proxy]" >&2; exit 1;; + v) ffmpegversion="${OPTARG}";; + *) echo "usage: $0 [-a patch|unpatch] [-b branch] [-p http://proxy] [-v ffmpegVersion]" >&2; exit 1;; esac done +if [[ "$ffmpegversion" == "4" ]]; then + ffmpegversion="" +fi + +dependencies=("VideoStation" "ffmpeg$ffmpegversion") + welcome_motd info "You're running DSM $dsm_version"