Add flags and improvements (#41)
This commit is contained in:
parent
f1546ff2ed
commit
049cf9a379
24
README.md
24
README.md
@ -1,23 +1,21 @@
|
|||||||
# VideoStation-FFMPEG-Patcher
|
# VideoStation-FFMPEG-Patcher
|
||||||
|
|
||||||
<p>
|
<p align="center">
|
||||||
<img src="https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/banner.png?raw=true" height=200px alt="Banner">
|
<img src="https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/banner.png?raw=true" height=200px alt="Banner">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
This patcher is designed to simplify the installation steps from this [Gist](https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e) (huge thanks to [Benjamin Poncet](https://github.com/BenjaminPoncet)) and enable **DTS**, **EAC3** and **TrueHD** support to Synology VideoStation by replacing the ffmpeg library files by a wrapper using SynoCommunity ffmpeg.
|
This patcher is designed to simplify the installation steps from this [Gist](https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e) (huge thanks to [Benjamin Poncet](https://github.com/BenjaminPoncet)) and enable **DTS**, **EAC3** and **TrueHD** support to Synology VideoStation by replacing the ffmpeg library files by a wrapper using SynoCommunity ffmpeg.
|
||||||
|
|
||||||
## Supported architectures
|
|
||||||
([check your NAS architecture here](https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model))
|
|
||||||
- ARMv8 ✅ (DSM 7.0 ready)
|
|
||||||
- Old ARM ✅ (DSM 7.0 ready)
|
|
||||||
- x64 ✅ (DSM 7.0 ready)
|
|
||||||
- x86 ✅ (DSM 7.0 ready)
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
- DSM 6.2.2-24922 Update 4 (and above)
|
- DSM 6.2.2-24922 Update 4 (and above)
|
||||||
- Video Station 2.4.6-1594 (and above)
|
- Video Station 2.4.6-1594 (and above)
|
||||||
- SynoCommunity ffmpeg 4.2.1-23 (and above) ([help](https://synocommunity.com/#easy-install))
|
- SynoCommunity ffmpeg 4.2.1-23 (and above) ([help](https://synocommunity.com/#easy-install))
|
||||||
|
|
||||||
|
## Supported / Unsupported scenarios
|
||||||
|
- [DTS or EAC3 or TrueHD] + [Any non HEVC standard video format]: ✅
|
||||||
|
- [no DTS, no EAC3, no TrueHD] + [HEVC]: ✅
|
||||||
|
- [DTS or EAC3 or TrueHD] + [HEVC]: ❌ (Please don't submit any more issue related to this scenario, I'm working on it, see [#33](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/pull/33))
|
||||||
|
|
||||||
## Instructions
|
## Instructions
|
||||||
- Check that you meet the required [dependencies](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#dependencies)
|
- Check that you meet the required [dependencies](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#dependencies)
|
||||||
- Install SynoCommunity ffmpeg ([help](https://synocommunity.com/#easy-install))
|
- Install SynoCommunity ffmpeg ([help](https://synocommunity.com/#easy-install))
|
||||||
@ -30,9 +28,9 @@ This patcher is designed to simplify the installation steps from this [Gist](htt
|
|||||||
Basic command:
|
Basic command:
|
||||||
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash`
|
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash`
|
||||||
With options:
|
With options:
|
||||||
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash -s -- <option>`
|
`curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash -s -- <flags>`
|
||||||
|
|
||||||
| Options | Description |
|
| Flags | Required | Description |
|
||||||
| ------ | ----------- |
|
|-------|----------|---------------------------------------------------------------------------------|
|
||||||
| -patch | patch VideoStation and CodecPack |
|
| -a | No | Action flag: choose between patch or unpatch ; example: `-a patch` |
|
||||||
| -unpatch | restore VideoStation and CodecPack to default files
|
| -b | No | Branch flag: allows you to choose the wrapper branch to use ; example `-b main` |
|
||||||
|
156
patcher.sh
156
patcher.sh
@ -6,53 +6,57 @@
|
|||||||
|
|
||||||
dsm_version=$(cat /etc.defaults/VERSION | grep productversion | sed 's/productversion=//' | tr -d '"')
|
dsm_version=$(cat /etc.defaults/VERSION | grep productversion | sed 's/productversion=//' | tr -d '"')
|
||||||
repo_base_url=https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher
|
repo_base_url=https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher
|
||||||
vs_bin_path=/var/packages/VideoStation/target/bin
|
action="patch"
|
||||||
|
branch="main"
|
||||||
|
dependencies=("ffmpeg")
|
||||||
|
vs_path=/var/packages/VideoStation/target
|
||||||
|
libsynovte_path="$vs_path/lib/libsynovte.so"
|
||||||
cp_bin_path=/var/packages/CodecPack/target/bin
|
cp_bin_path=/var/packages/CodecPack/target/bin
|
||||||
declare -a cp_to_patch=("ffmpeg41" "ffmpeg27")
|
cp_to_patch=("ffmpeg41" "ffmpeg27")
|
||||||
ffmpeg_bin_path=/var/packages/ffmpeg/target/bin
|
|
||||||
libsynovte_path=/var/packages/VideoStation/target/lib/libsynovte.so
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# UTILS
|
# UTILS
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2"
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2"
|
||||||
}
|
}
|
||||||
function info() {
|
function info() {
|
||||||
log "INFO" "$1"
|
log "INFO" "$1"
|
||||||
}
|
}
|
||||||
function error() {
|
function error() {
|
||||||
log "ERROR" "$1"
|
log "ERROR" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function welcome_motd() {
|
function welcome_motd() {
|
||||||
info "ffmpeg-patcher v1.5"
|
info "ffmpeg-patcher v1.5"
|
||||||
|
|
||||||
motd=$(curl -s -L "$repo_base_url/blob/main/motd.txt?raw=true")
|
motd=$(curl -s -L "$repo_base_url/blob/$branch/motd.txt?raw=true")
|
||||||
if [ "${#motd}" -ge 1 ]; then
|
if [ "${#motd}" -ge 1 ]; then
|
||||||
log "Message of the day"
|
log "Message of the day"
|
||||||
echo ""
|
echo ""
|
||||||
echo "$motd"
|
echo "$motd"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restart_packages() {
|
function restart_packages() {
|
||||||
if [[ -d $cp_bin_path ]]; then
|
if [[ -d $cp_bin_path ]]; then
|
||||||
log "INFO" "Restarting CodecPack..."
|
log "INFO" "Restarting CodecPack..."
|
||||||
synopkg restart CodecPack
|
synopkg restart CodecPack
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Restarting VideoStation..."
|
info "Restarting VideoStation..."
|
||||||
synopkg restart VideoStation
|
synopkg restart VideoStation
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_dependencies() {
|
function check_dependencies() {
|
||||||
if [[ ! -d $ffmpeg_bin_path ]]; then
|
for dependecy in "${dependencies[@]}"; do
|
||||||
error "Missing SynoCommunity ffmpeg package, please install it and re-run the patcher."
|
if [[ ! -d "/var/packages/$dependecy" ]]; then
|
||||||
exit 1
|
error "Missing $dependecy package, please install it and re-run the patcher."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
################################
|
################################
|
||||||
@ -60,84 +64,84 @@ function check_dependencies() {
|
|||||||
################################
|
################################
|
||||||
|
|
||||||
function patch() {
|
function patch() {
|
||||||
info "====== Patching procedure ======"
|
info "====== Patching procedure (branch: $branch) ======"
|
||||||
|
|
||||||
info "Saving current ffmpeg as ffmpeg.orig"
|
info "Saving current ffmpeg as ffmpeg.orig"
|
||||||
mv -n "$vs_bin_path/ffmpeg" "$vs_bin_path/ffmpeg.orig"
|
mv -n "$vs_path/bin/ffmpeg" "$vs_path/bin/ffmpeg.orig"
|
||||||
|
|
||||||
info "Downloading ffmpeg's wrapper..."
|
info "Downloading ffmpeg's wrapper..."
|
||||||
wget -q -O - "$repo_base_url/blob/main/ffmpeg-wrapper.sh?raw=true" > "$vs_bin_path/ffmpeg"
|
wget -q -O - "$repo_base_url/blob/$branch/ffmpeg-wrapper.sh?raw=true" > "$vs_path/bin/ffmpeg"
|
||||||
chown root:VideoStation "$vs_bin_path/ffmpeg"
|
chown root:VideoStation "$vs_path/bin/ffmpeg"
|
||||||
chmod 750 "$vs_bin_path/ffmpeg"
|
chmod 750 "$vs_path/bin/ffmpeg"
|
||||||
chmod u+s "$vs_bin_path/ffmpeg"
|
chmod u+s "$vs_path/bin/ffmpeg"
|
||||||
|
|
||||||
if [[ -d $cp_bin_path ]]; then
|
if [[ -d $cp_bin_path ]]; then
|
||||||
for filename in "${cp_to_patch[@]}"; do
|
for filename in "${cp_to_patch[@]}"; do
|
||||||
if [[ -f "$cp_bin_path/$filename" ]]; then
|
if [[ -f "$cp_bin_path/$filename" ]]; then
|
||||||
info "Patching CodecPack's $filename"
|
info "Patching CodecPack's $filename"
|
||||||
|
|
||||||
mv -n "$cp_bin_path/$filename" "$cp_bin_path/$filename.orig"
|
mv -n "$cp_bin_path/$filename" "$cp_bin_path/$filename.orig"
|
||||||
ln -s -f "$vs_bin_path/ffmpeg" "$cp_bin_path/$filename"
|
ln -s -f "$vs_path/bin/ffmpeg" "$cp_bin_path/$filename"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Saving current libsynovte.so as libsynovte.so.orig"
|
info "Saving current libsynovte.so as libsynovte.so.orig"
|
||||||
cp -n "$libsynovte_path" "$libsynovte_path.orig"
|
cp -n "$libsynovte_path" "$libsynovte_path.orig"
|
||||||
chown VideoStation:VideoStation "$libsynovte_path.orig"
|
chown VideoStation:VideoStation "$libsynovte_path.orig"
|
||||||
|
|
||||||
info "Enabling eac3, dts and truehd"
|
info "Enabling eac3, dts and truehd"
|
||||||
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' "$libsynovte_path"
|
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' "$libsynovte_path"
|
||||||
|
|
||||||
restart_packages
|
restart_packages
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
info "Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
|
info "Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function unpatch() {
|
function unpatch() {
|
||||||
info "====== Unpatch procedure ======"
|
info "====== Unpatch procedure ======"
|
||||||
|
|
||||||
info "Restoring libsynovte.so"
|
info "Restoring libsynovte.so"
|
||||||
mv -f "$libsynovte_path.orig" "$libsynovte_path"
|
mv -f "$libsynovte_path.orig" "$libsynovte_path"
|
||||||
|
|
||||||
info "Restoring VideoStation's ffmpeg"
|
info "Restoring VideoStation's ffmpeg"
|
||||||
mv -f "$vs_bin_path/ffmpeg.orig" "$vs_bin_path/ffmpeg"
|
mv -f "$vs_path/bin/ffmpeg.orig" "$vs_path/bin/ffmpeg"
|
||||||
|
|
||||||
if [[ -d $cp_bin_path ]]; then
|
if [[ -d $cp_bin_path ]]; then
|
||||||
find $cp_bin_path -type f -name "ffmpeg*.orig" | while read filename
|
find $cp_bin_path -type f -name "ffmpeg*.orig" | while read filename; do
|
||||||
do
|
info "Restoring CodecPack's $filename"
|
||||||
info "Restoring CodecPack's $filename"
|
mv -T -f "$filename" "${filename::-5}"
|
||||||
mv -T -f "$filename" "${filename::-5}"
|
done
|
||||||
done
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
restart_packages
|
restart_packages
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
info "unpatch complete"
|
info "unpatch complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# ENTRYPOINT
|
# ENTRYPOINT
|
||||||
################################
|
################################
|
||||||
welcome_motd
|
while getopts a:b: flag; do
|
||||||
arg1=${1:--patch}
|
case "${flag}" in
|
||||||
|
a) action=${OPTARG};;
|
||||||
|
b) branch=${OPTARG};;
|
||||||
|
*) echo "usage: $0 [-a patch|unpatch] [-b branch]" >&2; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
welcome_motd
|
||||||
check_dependencies
|
check_dependencies
|
||||||
|
|
||||||
info "You're running DSM $dsm_version"
|
info "You're running DSM $dsm_version"
|
||||||
if [[ $dsm_version > 7.0 ]]; then
|
if [[ $dsm_version > 7.0 ]]; then
|
||||||
cp_bin_path=/var/packages/CodecPack/target/pack/bin
|
cp_bin_path=/var/packages/CodecPack/target/pack/bin
|
||||||
|
info "Tuned script for DSM $dsm_version"
|
||||||
info "Tuned script for DSM $dsm_version"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$arg1" in
|
case "$action" in
|
||||||
-unpatch)
|
unpatch) unpatch;;
|
||||||
unpatch
|
patch) patch;;
|
||||||
;;
|
|
||||||
-patch)
|
|
||||||
patch
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user