Original link of this gist: https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e
Installation instructions
The purpose of this script is to replace Synology VideoStation's ffmpeg by SynoCommunity's ffmpeg in order to increase Synology VideoStation's codec support such as DTS, EAC3 and TrueHD as well as various optimizations.
This wrapper script and these instructions are a kind of compilation of 278 comments on more than 2 years of exchanges on the following issue SynoCommunity/spksrc#2952
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) (see: https://synocommunity.com/#easy-install)
- Find your NAS arch to follow the correct installation instructions :
https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model
Installation (for rtd1296 armv8)
On last ARM NAS, Synology uses gstreamer to transcode video instead of ffmpeg. So that wrapper only partially works.
On the other hand, it's possible to get libs supporting DTS, EAC3 and TrueHD on VideoStation version 2.3.4 to use them on VideoStation version 2.4.6.
Here is how to proceed:
- Uninstall VideoStation (you can keep the database, it will be recognized by version 2.3.4)
- Download version 2.3.4 here
- Install the SPK via the "Manual installation" of the "Package Center".
- Connecting to the NAS via SSH with "admin" user (some help here)
- Use the command
sudo -i
to switch to root user (same password as for "admin") - Copy / paste the following commands:
# Copy VideoStation's ffmpeg libs
cp -a /var/packages/VideoStation/target/lib/ffmpeg /tmp/
- Update VideoStation in "Package Center"
- Copy / paste the following commands:
# Save VideoStation's ffmpeg libs
mv -n /var/packages/VideoStation/target/lib/ffmpeg /var/packages/VideoStation/target/lib/ffmpeg.orig
# Replace by old VideoStation's ffmpeg libs
mv /tmp/ffmpeg /var/packages/VideoStation/target/lib/
# Save VideoStation's libsynovte.so
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
# Patch libsynovte.so to authorize DTS, EAC3 and TrueHD
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so
- Restart VideoStation (Stop/Start in "Package Center")
Uninstallation (for rtd1296 armv8)
- Copy / paste the following commands:
# Restore VideoStation's ffmpeg libs, libsynovte.so
rm -f /var/packages/VideoStation/target/lib/ffmpeg
mv -f /var/packages/VideoStation/target/lib/ffmpeg.orig /var/packages/VideoStation/target/lib/ffmpeg
mv -f /var/packages/VideoStation/target/lib/libsynovte.so.orig /var/packages/VideoStation/target/lib/libsynovte.so
- Or, more simply, uninstall and re-install VideoStation
Installation (for x64, x86 and old arm arch)
- Connecting to the NAS via SSH with "admin" user (some help here)
- Use the command
sudo -i
to switch to root user (same password as for "admin") - Copy / paste the following commands:
# Save VideoStation's ffmpeg
mv -n /var/packages/VideoStation/target/bin/ffmpeg /var/packages/VideoStation/target/bin/ffmpeg.orig
# Injecting the script (last revision aka 12)
wget -O - https://gist.githubusercontent.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e/raw/ffmpeg-wrapper > /var/packages/VideoStation/target/bin/ffmpeg
# Change ownership and mode of the script
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 VideoStation's libsynovte.so
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
# Patch libsynovte.so to authorize DTS, EAC3 and TrueHD
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so
- Restart VideoStation (Stop/Start in "Package Center")
Update the wrapper (for x64, x86 and old arm arch)
- Copy / paste the following commands:
# Injecting the script (last revision aka 12)
wget -O - https://gist.githubusercontent.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e/raw/ffmpeg-wrapper > /var/packages/VideoStation/target/bin/ffmpeg
Uninstallation (for x64, x86 and old arm arch)
- Copy / paste the following commands:
# Restore VideoStation's ffmpeg, libsynovte.so
mv -f /var/packages/VideoStation/target/bin/ffmpeg.orig /var/packages/VideoStation/target/bin/ffmpeg
mv -f /var/packages/VideoStation/target/lib/libsynovte.so.orig /var/packages/VideoStation/target/lib/libsynovte.so
- Or, more simply, uninstall and re-install VideoStation
Feedback
Leaving a feedback when there is a problem or a suggestion is very useful but leaving one when everything is going well is just as useful.
If the wapper works well for you, please leave a comment with the following information (e.g.):
Synology DS718+ / DSM 6.2.2-24922 Update 4 / Video Station 2.4.6-1594 / ffmpeg 4.2.1-19 / ffmpeg wrapper (rev8):
Everything's working fine! But a high CPU load in h265 10bit 4k
Feel free to read the reviews already present in the Compatibility section, you will surely find useful information.
Compatibility
The wrapper is supposed to work with the latest versions of DSM / VideoStation for all Synology NAS.
Here below the list of the tests performed so far according to softwares different versions:
DSM 6.2.2 / Video Station 2.4.6 / ffmpeg 4.2.1-23
- ffmpeg wrapper rev8-11
Alternative
If you are uncomfortable with this procedure, if your NAS is not yet compatible with ffmpeg pre-release or if you can't get the desired result, you can also downgrade VideoStation to version 2.3.4 which is the latest version compatible with DTS, EAC3 and TrueHD by simply installing SynoCommunity ffmpeg and without any command line.
Here is the procedure to follow:
- Uninstall VideoStation (you can keep the database, it will be recognized by version 2.3.4)
- Download version 2.3.4 here
- Install the SPK via the "Manual installation" of the "Package Center".
- Install the latest ffmpeg version of SynoCommunity: https://synocommunity.com (with VideoStation version 2.3.4 the official ffmpeg version of SynoCommunity works)
Current issues
- https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e#gistcomment-3125134
- https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e#gistcomment-3121904
- https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e#gistcomment-3124851
- https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e#gistcomment-3133567