diff --git a/README.md b/README.md index 50d7ae0..95ffe94 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,22 @@ 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 the one of VideoStation-2.3.4-1468 (which supported those formats). -## Instructions -⚠️ Currently only working for rtd1296 ARMv8 architecture, I may do it for other CPUs if someone asks for it ([check your NAS architecture here](https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model). ⚠️ +## Supported architectures +([check your NAS architecture here](https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model)) +- ARMv8 ✅ +- Old ARM ✅ +- x64 ✅ +- x86 ✅ +## Dependencies +- DSM 6.2.2-24922 Update 4 (and above) +- Video Station 2.4.6-1594 (and above) +- SynoCommunity ffmpeg 4.2.1-23 (and above) ([help](https://synocommunity.com/#easy-install)) + +## Instructions +- Check that you meet the required dependencies - 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 folowing command to execute the patch: `curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/patcher.sh | bash` - Restart VideoStation (stop & start from Package Center) +- VideoStation will have to be repatched everytime you update it (and when you update DSM) diff --git a/patcher.sh b/patcher.sh index 88e7d85..801c9cc 100755 --- a/patcher.sh +++ b/patcher.sh @@ -1,15 +1,21 @@ #!/bin/bash -function run() { - if [[ ! $(cat /proc/cpuinfo | grep 'model name' | uniq) =~ "ARMv8" ]]; then - echo "[ERROR] This script is only intended for ARMv8 CPUs" - return -1 - fi - +function save_current() { echo "[INFO] Saving current ffmpeg as ffmpeg.orig" mv -n /var/packages/VideoStation/target/lib/ffmpeg /var/packages/VideoStation/target/lib/ffmpeg.orig +} - echo "[INFO] Downloading patched ffmpeg files to /tmp/ffmpeg" +function save_and_patch() { + cp -n /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.orig + chown VideoStation:VideoStation /var/packages/VideoStation/target/lib/libsynovte.so.orig + + sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so +} + +function armv8_procedure() { + save_current + + echo "[INFO] Downloading patched ffmpeg files to /var/packages/VideoStation/target/lib" echo "" declare -a ffmpegfiles=( @@ -21,25 +27,49 @@ function run() { "libpostproc.so.53" "libswresample.so.1" "libswscale.so.3" - ) + ); - mkdir /tmp/ffmpeg + if [[ ! -d /var/packages/VideoStation/target/lib/ffmpeg ]]; then + echo "[INFO] Creating ffmpeg directory" + mkdir /var/packages/VideoStation/target/lib/ffmpeg + fi for file in "${ffmpegfiles[@]}" do - wget -O "/tmp/ffmpeg/$file" "https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/ffmpeg/$file?raw=true" + echo "[INFO] Downloading $file ..." + wget -q -O "/var/packages/VideoStation/target/lib/ffmpeg/$file" "https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/blob/main/ffmpeg/$file?raw=true" done - mv /tmp/ffmpeg /var/packages/VideoStation/target/lib/ - - cp -n /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.orig - chown VideoStation:VideoStation /var/packages/VideoStation/target/lib/libsynovte.so.orig - - sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so + save_and_patch echo "" echo "[SUCCESS] Done patching, please restart VideoStation (stop and start from package center)" } -run +function others_procedure() { + save_current + + wget -O - https://gist.githubusercontent.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e/raw/ffmpeg-wrapper > /var/packages/VideoStation/target/bin/ffmpeg + + chown root:VideoStation /var/packages/VideoStation/target/bin/ffmpeg + chmod 750 /var/packages/VideoStation/target/bin/ffmpeg + chmod u+s /var/packages/VideoStation/target/bin/ffmpeg + + save_and_patch + + mv /var/packages/CodecPack/target/bin/ffmpeg33 /var/packages/CodecPack/target/bin/ffmpeg33.orig + cp /var/packages/VideoStation/target/bin/ffmpeg /var/packages/CodecPack/target/bin/ffmpeg33 + + mv /var/packages/CodecPack/target/bin/ffmpeg41 /var/packages/CodecPack/target/bin/ffmpeg41.orig + cp /var/packages/VideoStation/target/bin/ffmpeg /var/packages/CodecPack/target/bin/ffmpeg41 + + echo "" + echo "[SUCCESS] Done patching, please restart VideoStation (stop and start from package center)" +} + +if [[ $(cat /proc/cpuinfo | grep 'model name' | uniq) =~ "ARMv8" ]]; then + armv8_procedure +else + others_procedure +fi