Serviio 2.0 package for Synology NAS

Serviio 1.6 in DSM Package Center

Update – Serviio version 2.0 is a new major version, so existing Serviio 1.x licences will not unlock the Pro features without a fresh licence purchase. If you wish to downgrade back to version 1.10.1 you may manually install the older package (merged architectures, or evansport) but your media library will need to be rebuilt.

Running the Serviio DLNA server on a NAS is a very efficient solution. It allows all your media to be constantly available to all your devices, all without the need for a dedicated media PC. Most TV and Bluray players are already capable media renderers – so indexing the library, retrieving metadata, and streaming the content are where Serviio fits in. Device support is continually improved by a community of contributors, and this crowd-sourced aspect was what initially drew me to the project, leading me to create the Sony Bluray device profile back in 2010. Serviio can also connect to online sources of content such as catch-up TV portals and allow fuss free content playback without advertising, even on devices which lack native support. These online plugins are also community maintained.

This new version of the Synology package updates Serviio to version 2.0 which fixes some issues and introduces multiple user support (release notes). Version 1.10 improved MediaBrowser, and also 4K media support. Version 1.9 replaced the Flash Player dependency in MediaBrowser with an HTML5 player. Serviio 1.7 brought audio track selection preferences, and automatic subtitle downloading. The most significant enhancement from version 1.6 onwards is the new web management console which removes the need to install the separate Serviio Console application on a computer. The web console uses a modern adaptive design which works well on mobile devices, and it is now integrated with DSM so you will see its icon in the application menu when the package is running:

Serviio-DSM-integration
Serviio 1.6 web console
The package supports hardware transcoding on the DS214play and DS415play with Intel Evansport media processor. This support required substantial personal effort and was made possible by the very kind donation of a new DS214play unit from MrK/Boretom a fellow package maintainer for ASUStor devices.

 

Limitations

If you use a TV, Bluray or media player bought in the last few years it is likely to have very good format support. In this case even a low specification NAS will be adequate for streaming most video content. There are some limitations however, in particular with video transcoding.

Serviio’s MediaBrowser is a Pro version only feature, and is designed to allow direct playback of media on tablet devices without the need for dedicated apps. Please note that Apple iOS devices require video in H.264 and audio in stereo AAC format when streaming. With the exception of the “play” models already mentioned, most Synology NAS models lack the CPU power to transcode video into H.264 in realtime. Even if the source video is already H.264, ARMv5 family CPUs (which lack an FPU) in the older models lack the power even to transcode AAC audio in realtime without libfdk_aac. Unfortunately I am unable to distribute an FFmpeg binary compiled against this library under the terms of its software license.

Ever since Serviio version 1.2 renderers that do not natively support subtitles via DLNA can have them burned into the video during transcoding, but as already explained a NAS usually lacks the CPU power to do this (more info on subs here). If you absolutely need hard subs for a particular film, you could start playback on your device then stop it and Serviio will continue transcoding. Then you will be able to try again in a few hours since it will play from the transcode cache folder. Newer TVs tend to support inline SRT subs, but for those with older models I can recommend the PlayStation 4 Media Player as a competent DLNA renderer with inline subs support.

I was able to compile FFmpeg for all eight supported architectures (ARMv5, ARMv7, ARMv7 with NEON, ARMv8, Intel i686, Intel x64, Intel Evansport media processor, and PowerPC e500v2) with the additional libraries Serviio requires while using the libs included within DSM as far as possible. I have published my compilation methods to make the process easier for others in future since parts of it were difficult to figure out. Only the Intel CPU or higher end ARM CPUs are likely to be of any practical use transcoding to H.264, since the other CPU types lack vector units (no AltiVec in QorIQ/PowerQUICC, and no NEON in Armada 370/XP).

 

Synology Package Installation

  • In Synology DSM’s Package Center, click Settings and add my package repository:
    Add Package Repository
  • The repository will push its certificate automatically to the NAS, which is used to validate package integrity. Set the Trust Level to Synology Inc. and trusted publishers:
    Trust Level
  • Serviio now requires Java 8 for OS-native filesystem watching, so you will need to install my Java SE Embedded package first if you have not already done so. Read the instructions on that page carefully too.
  • Now browse the Community section in Package Center to install Serviio:
    Community-packages
    Community packages are not listed in the All category for some reason. The repository only displays packages which are compatible withĀ your specific model of NAS. If you don’t see Serviio in the list, then either your NAS model or your DSM version are not supported at this time. DSM 6.0 is the minimum supported version for this package.
  • When Serviio is started for the first time, a plugins folder will be created in the public shared folder (usually /volume1/public/serviio/plugins/). Download any Serviio online content plugins that you require and place the .groovy files in that location.
  • If you need subtitle support for glyphs not present in the default DejaVu fonts, add additional fonts to the following folder inside your NAS’s public shared folder (usually /volume1/public/serviio/fonts/).
 

Notes

  • You should reserve an IP address for your NAS (most home broadband routers will let you do this in the DHCP options), or use a static IP address. This will prevent Serviio from appearing multiple times in the menus of your renderer devices as its IP changes.
  • In the console disable ‘Generate thumbnails for local videos’ in the Metadata tab. Failure to do this can make adding videos to your library very slow on older NAS systems. With this disabled Serviio will still fetch thumbnail images automatically from the online databases.
  • Don’t alter the transcoded files location on the Transcoding tab, it’s already set to a sensible location for Synology systems. This particular folder is deleted each time your NAS restarts, and Serviio cleans up its temp files automatically in any case.
  • When adding folders to the media library use the Browse button. This will show the root of the entire NAS Linux filesystem, so you will find your DSM shared folders inside /volume1.
  • If you’re upgrading from a previous Serviio version you should check for updates of your online content plugins.
  • MediaBrowser (Pro only feature) can be opened using the link in the side bar of the web console (http://IPofYourNAS:23424/mediabrowser). If you want to use the MediaBrowser from a remote location you would need to either port forward 23424 on your router, or use SSH tunnelling. You can also manage Serviio remotely by SSH tunnelling port 23423 which the console uses. Both of these service definitions are added to the DSM Firewall.
  • Advanced users who wish to edit device profiles or enable debug logging can find the Serviio files in /var/packages/Serviio/target. You will need to use an SSH session to access this folder – it cannot be navigated to using DSM’s File Station. You will need to restart the Serviio package for profile changes to take effect.
  • Some users may wish to restrict running Serviio to specificĀ times of day in order to free up RAM for a scheduled backup window for instance. This can be achieved by creating tasks to start and stop Serviio using the Task Scheduler in DSM Control Panel:
    Schedule service start
  • The package uses an FFmpeg wrapper script to modify the usual transcoding behaviour of Serviio to use the Intel Evansport hardware decoding and encoding available in the DS214play and DS415play models. I have left the FFmpeg wrapper scripts in the package even when not in use (in the Serviio/bin folder), because they are still useful for people trying to test a particular workaround or encoder setting. The wrapper was a tricky script to get working due to variable expansion precedence issues and quote handling. If you need it, just change the ffmpeg.location system property in /var/packages/Serviio/target/bin/serviio.sh to point to your modified wrapper script.
  • If additional fonts are not working as expected, some troubleshooting is available. You can re-create the fontconfig cache by connecting to the NAS via an SSH session as admin, and then running:
    sudo -i
    (enter admin password to become root)
    rm -rf ~/.fontconfig.cache
    FC_DEBUG=128 /var/packages/Serviio/target/bin/fc-cache --verbose
 

Hardware transcoding support

  • DS214play and DS415play with Intel Evansport SoC are the only models supported for hardware transcoding. Serviio uses the multimedia tool FFmpeg for manipulating media files, and I am only able to build a hardware-assisted FFmpeg for DS214play and DS215play. Subsequent to those products, Synology has marketed a number of other systems with hardware transcoding features but these are not supported by Serviio.
    The DS216play with STiH412 Monaco SoC uses a specialised build of Gstreamer for the Synology transcoding solution rather than FFmpeg, so its hardware features cannot be used by Serviio.
    It seems likely that Synology is also using Gstreamer for the Intel Braswell or newer generation CPUs with QuikSync, since DSM ships with an older FFmpeg (2.7.1) than the version which introduced QuikSync support (2.8.0). To implement FFmpeg QuikSync hardware transcoding support requires Linux kernel patches for libmfx support which is not currently included in DSM 6.x, so Serviio support for Intel QuikSync on Synology is unlikely unless Synology in future switches to using FFmpeg for its own hardware transcoding solution.
    The DS218play with Realtek RTD1296 SoC uses Gstreamer with OpenMAX drivers for the Synology transcoding solution. Although I was able to compile the ARMv8 build of FFmpeg with libomx support, unfortunately the Belaggio OpenMAX IL will not register these Realtek drivers which are distributed in the VideoStation package, therefore the hardware transcoding features of this model cannot be used by Serviio.
  • For the supported systems FFmpeg will use hardware decoding wherever possible.
  • Although multiple hardware assisted decodes can take place simultaneously, only a single hardware encode is available. The package intelligently avoids race conditions for this.
  • Any FFmpeg commandline to encode using libx264 will automatically be sent to the hardware encoder when available.
  • profiles.xml has been modified so that the preferred transcode format for most devices for non-natively supported videos is H.264.
  • In order to add hardware H.264 encoding to a device profile, specify h264 as the desired codec and the FFmpeg wrapper script will make the necessary substitution automatically.
  • When the hardware encoder is used, the low quality settings in Serviio’s default libx264 options to favour encoding speed are ignored. The hardware encoder performance is not altered by quality settings.
  • If a media stream is being both hardware decoded and hardware encoded, it will use pipelined mode. Based on responses from Synology support during development this means that both jobs occur on the media processor without exposing the intermediate bitstream to FFmpeg. Consequently it is not possible to burn subtitles in pipelined mode. As a result my FFmpeg wrapper script will run the decode part of the job in software in order to do this. The unfortunate result is that the encoder cannot quite achieve real time transcoding during subtitle compositing. For full 1080p HD material it achieves around 20fps, whereas most movies are 24fps. This means that in order to watch a film with hard subs you would need to start it off, pause or stop the renderer and return a bit later to view. An alternative would be to mux the content into an MKV container with the desired subtitles before adding it to the Serviio library, assuming that your device supports SRTs in MKV.
  • The hardware encoded H.264 streams are not 100% compliant with the specification and fail validation using the tool DGAVCDec. For most tested renderers this does not affect playback (Bravia, Sony Bluray, iOS). FlowPlayer which had been the embedded player in MediaBrowser did not play these files satisfactorily and dropped many frames resulting in jerky playback. However since Serviio version 1.9 MediaBrowser uses an HTML5 player which is not affected by this issue.
 

Package scripts

For information, here are the package scripts so you can see what it’s going to do. You can get more information about how packages work by reading the Synology 3rd Party Developer Guide.

installer.sh

#!/bin/sh

#--------SERVIIO installer script
#--------package maintained at pcloadletter.co.uk


DOWNLOAD_PATH="http://download.serviio.org/releases"
DOWNLOAD_FILE="serviio-2.0-linux.tar.gz"
EXTRACTED_FOLDER="serviio-2.0"
DOWNLOAD_URL="${DOWNLOAD_PATH}/${DOWNLOAD_FILE}"
SYNO_CPU_ARCH="`uname -m`"
[ "${SYNO_CPU_ARCH}" == "x86_64" ] && SYNO_CPU_ARCH="x64"
[ "${SYNOPKG_DSM_ARCH}" == "comcerto2k" ] && SYNO_CPU_ARCH="armneon"
[ "${SYNOPKG_DSM_ARCH}" == "armada375" ] && SYNO_CPU_ARCH="armneon"
[ "${SYNOPKG_DSM_ARCH}" == "armada38x" ] && SYNO_CPU_ARCH="armneon"
[ "${SYNOPKG_DSM_ARCH}" == "alpine" ] && SYNO_CPU_ARCH="armneon"
[ "${SYNOPKG_DSM_ARCH}" == "alpine4k" ] && SYNO_CPU_ARCH="armneon"
[ "${SYNOPKG_DSM_ARCH}" == "monaco" ] && SYNO_CPU_ARCH="armneon"
[ "${WIZARD_ENC_HW}" == "true" ] && SYNO_CPU_ARCH="i686evansport"
NATIVE_BINS_URL="http://packages.pcloadletter.co.uk/downloads/serviio-native-${SYNO_CPU_ARCH}.tar.xz"   
NATIVE_BINS_FILE="`echo ${NATIVE_BINS_URL} | sed -r "s%^.*/(.*)%\1%"`"
FONTS_URL="http://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2"
FONTS_FILE="`echo ${FONTS_URL} | sed -r "s%^.*/(.*)%\1%"`"
#'ua' prefix means wget user-agent will be customized
INSTALL_FILES="ua${DOWNLOAD_URL} ${NATIVE_BINS_URL} ${FONTS_URL}"
PID_FILE="${SYNOPKG_PKGDEST}/serviio.pid"
COMMENT="# Synology Serviio Package"
TEMP_FOLDER="`find / -maxdepth 2 -path '/volume?/@tmp' | head -n 1`"
PUBLIC_FOLDER="`synoshare --get public | sed -r "/Path/!d;s/^.*\[(.*)\].*$/\1/"`"
PLUGINS_PATH="${PUBLIC_FOLDER}/serviio"
source /etc/profile


pre_checks ()
{
  #These checks are called from preinst and from preupgrade functions to prevent failures resulting in a partially upgraded package
  if [ -z ${JAVA_HOME} ]; then
    echo "Java is not installed or not properly configured. JAVA_HOME is not defined. " >> $SYNOPKG_TEMP_LOGFILE
    echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  fi

  if [ ! -f ${JAVA_HOME}/bin/java ]; then
    echo "Java is not installed or not properly configured. The Java binary could not be located. " >> $SYNOPKG_TEMP_LOGFILE
    echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  fi

  JAVA_VER=`java -version 2>&1 | sed -r "/^.* version/!d;s/^.* version \"[0-9]\.([0-9]).*$/\1/"`
  if [ ${JAVA_VER} -lt 8 ]; then
    echo "This version of Serviio requires Java 8 or newer. Please update your Java package. " >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  fi

  if [ -z ${PUBLIC_FOLDER} ]; then
    echo "A shared folder called 'public' could not be found - note this name is case-sensitive. " >> $SYNOPKG_TEMP_LOGFILE
    echo "Please create this using the Shared Folder DSM Control Panel and try again." >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  fi
}


preinst ()
{
  pre_checks
  cd ${TEMP_FOLDER}
  for WGET_URL in ${INSTALL_FILES}
  do
    WGET_FILENAME="`echo ${WGET_URL} | sed -r "s%^.*/(.*)%\1%"`"
    [ -f ${TEMP_FOLDER}/${WGET_FILENAME} ] && rm ${TEMP_FOLDER}/${WGET_FILENAME}
    #this will allow serviio.org to track the number of downloads from Synology users
    WGET_URL=`echo ${WGET_URL} | sed -e "s/^ua/--user-agent=Synology --referer=http:\/\/pcloadletter.co.uk\/2012\/01\/25\/serviio-syno-package /"`
    wget ${WGET_URL}
    if [ $? != 0 ]; then
      if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/${WGET_FILENAME} ]; then
        cp ${PUBLIC_FOLDER}/${WGET_FILENAME} ${TEMP_FOLDER}
      else
        echo "There was a problem downloading ${WGET_FILENAME} from the official download link, " >> $SYNOPKG_TEMP_LOGFILE
        echo "which was \"${WGET_URL}\" " >> $SYNOPKG_TEMP_LOGFILE
        echo "Alternatively, you may download this file manually and place it in the 'public' shared folder. " >> $SYNOPKG_TEMP_LOGFILE
        exit 1
      fi
    fi
  done

  exit 0
}


postinst ()
{
  #extract the downloaded Serviio archive
  cd ${TEMP_FOLDER}
  tar xzf ${TEMP_FOLDER}/${DOWNLOAD_FILE}
  rm ${TEMP_FOLDER}/${DOWNLOAD_FILE}
  cp -R ${TEMP_FOLDER}/${EXTRACTED_FOLDER}/* ${SYNOPKG_PKGDEST}
  if [ ! -z "${EXTRACTED_FOLDER}" ]; then
    rm -r ${TEMP_FOLDER}/${EXTRACTED_FOLDER}
  fi
  if [ ! -d "${PLUGINS_PATH}/plugins" ]; then
    mkdir -p ${PLUGINS_PATH}/plugins
  fi
  if [ ! -d "${PLUGINS_PATH}/fonts" ]; then
    mkdir -p ${PLUGINS_PATH}/fonts
  fi

  #extract CPU-specific additional binaries
  cd ${SYNOPKG_PKGDEST}/lib
  tar xJf ${TEMP_FOLDER}/${NATIVE_BINS_FILE} && rm ${TEMP_FOLDER}/${NATIVE_BINS_FILE}
  mv ${SYNOPKG_PKGDEST}/lib/ffmpeg ${SYNOPKG_PKGDEST}/bin
  mv ${SYNOPKG_PKGDEST}/lib/fc-cache ${SYNOPKG_PKGDEST}/bin
  [ -e ${SYNOPKG_PKGDEST}/lib/omxregister-bellagio ] mv ${SYNOPKG_PKGDEST}/lib/omxregister-bellagio ${SYNOPKG_PKGDEST}/bin

  #remove legacy package font versions
  [ -d ${PLUGINS_PATH}/fonts/dejavu-fonts-ttf-2.33/ ] && rm -rf ${PLUGINS_PATH}/fonts/dejavu-fonts-ttf-2.33/
  [ -d ${PLUGINS_PATH}/fonts/dejavu-fonts-ttf-2.34/ ] && rm -rf ${PLUGINS_PATH}/fonts/dejavu-fonts-ttf-2.34/
  [ -d ${PLUGINS_PATH}/fonts/dejavu-fonts-ttf-2.35/ ] && rm -rf ${PLUGINS_PATH}/fonts/dejavu-fonts-ttf-2.35/

  #extract open source font package for subtitle support during transcoding
  cd ${PLUGINS_PATH}/fonts
  tar xvjf ${TEMP_FOLDER}/${FONTS_FILE} && rm ${TEMP_FOLDER}/${FONTS_FILE}
  sed -i "s|WINDOWSFONTDIR|${PLUGINS_PATH}/fonts|" ${SYNOPKG_PKGDEST}/config/fonts/fonts.conf
  sed -i "s|WINDOWSTEMPDIR_FONTCONFIG_CACHE|~/.fontconfig.cache|" ${SYNOPKG_PKGDEST}/config/fonts/fonts.conf

  #wrapper script can be useful for testing different encoder options
  if [ -e "${SYNOPKG_PKGDEST}/bin/ffmpeg-wrapper-${SYNO_CPU_ARCH}.sh" ]; then
    #we need to use the wrapper to make FFmpeg use libshine on ARM systems and to use hardware decode/encode on Intel Evansport systems
    FFMPEG_PATH="\$SERVIIO_HOME/bin/ffmpeg-wrapper-${SYNO_CPU_ARCH}.sh"
  else
    FFMPEG_PATH="\$SERVIIO_HOME/bin/ffmpeg"
  fi

  #modifications to device profiles (evansport hardware transcoding)
  if [ -e "${SYNOPKG_PKGDEST}/config/profiles-${SYNO_CPU_ARCH}.xml" ]; then
    mv "${SYNOPKG_PKGDEST}/config/profiles.xml" "${SYNOPKG_PKGDEST}/config/profiles-orig.xml"
    mv "${SYNOPKG_PKGDEST}/config/profiles-${SYNO_CPU_ARCH}.xml" "${SYNOPKG_PKGDEST}/config/profiles.xml"
  fi

  #modifications to application profiles (evansport hardware transcoding)
  #removed owing to frame drops in FlowPlayer because encoder does not produce 100% valid streams, evansport has sufficient power for flv encoding
  #if [ -e "${SYNOPKG_PKGDEST}/config/application-profiles-${SYNO_CPU_ARCH}.xml" ]; then
  #  mv "${SYNOPKG_PKGDEST}/config/application-profiles-${SYNO_CPU_ARCH}.xml" "${SYNOPKG_PKGDEST}/config/application-profiles.xml"
  #fi

  #make changes to Serviio launcher script so that pid file is created for Java process
  sed -r -i "s%Execute the JVM in the foreground%Execute the JVM in the background%" ${SYNOPKG_PKGDEST}/bin/serviio.sh
  sed -r -i "s%^(exec \"$JAVA.*)$%\1 \&%" ${SYNOPKG_PKGDEST}/bin/serviio.sh
  echo "echo \$! > ${PID_FILE}" >> ${SYNOPKG_PKGDEST}/bin/serviio.sh

  #set some additional Serviio system properties (temp folder, FFmpeg path, plugins folder)
  #http://www.serviio.org/index.php?option=com_content&view=article&id=43
  EXTRA_OPTS="-Dserviio\.defaultTranscodeFolder=${TEMP_FOLDER} -Dffmpeg\.location=${FFMPEG_PATH} -Dplugins\.location=${PLUGINS_PATH}"
  #fix Java prefs checking which was preventing NAS hibernation http://forum.serviio.org/viewtopic.php?f=5&t=6878
  EXTRA_OPTS="${EXTRA_OPTS} -Djava.util.prefs.syncInterval=86400"
  if [ "${SYNO_CPU_ARCH}" == "armv5tel" ]; then
    #use integer math (not floating point) Dolby AC-3 encoder for better performance on ARM CPUs
    #http://ffmpeg.org/ffmpeg.html#ac3-and-ac3_005ffixed
    EXTRA_OPTS="${EXTRA_OPTS} -Dserviio\.fixedPointEncoders"
  fi
  sed -r -i "s% -Dffmpeg\.location=ffmpeg%%; s%^(JAVA_OPTS=.*)\"$%\1 ${EXTRA_OPTS}\"%" ${SYNOPKG_PKGDEST}/bin/serviio.sh

  #create log file to allow package start errors to be captured
  [ -e ${SYNOPKG_PKGDEST}/log ] || mkdir ${SYNOPKG_PKGDEST}/log
  [ -e ${SYNOPKG_PKGDEST}/log/serviio.log ] || touch ${SYNOPKG_PKGDEST}/log/serviio.log

  #add firewall config
  /usr/syno/bin/servicetool --install-configure-file --package /var/packages/${SYNOPKG_PKGNAME}/conf/${SYNOPKG_PKGNAME}.sc > /dev/null

  exit 0
}


preuninst ()
{
  `dirname $0`/stop-start-status stop

  exit 0
}


postuninst ()
{
  #remove fontconfig configuration
  sed -i "/${COMMENT}/d" /root/.profile

  #remove firewall config
  if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" ]; then
    /usr/syno/bin/servicetool --remove-configure-file --package ${SYNOPKG_PKGNAME}.sc > /dev/null
  fi

  #remove legacy daemon user and homedir
  [ -e /var/services/homes/serviio ] && synouser --del serviio
  [ -e /var/services/homes/serviio ] && rm -r /var/services/homes/serviio

  exit 0
}


preupgrade ()
{
  `dirname $0`/stop-start-status stop
  pre_checks
  #if a media database exists we need to preserve it
  if [ -d ${SYNOPKG_PKGDEST}/library/db ]; then
    mkdir ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_db_migration
    mv ${SYNOPKG_PKGDEST}/library/db ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_db_migration
  fi

  exit 0
}


postupgrade ()
{
  #use the backed up media database from the previous version
  if [ -d ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_db_migration/db ]; then
    mv ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_db_migration/db ${SYNOPKG_PKGDEST}/library
    rmdir ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_db_migration
  fi
  chown -R root:root ${SYNOPKG_PKGDEST}

  exit 0
}
 

start-stop-status.sh

#!/bin/sh

#--------SERVIIO start-stop-status script
#--------package maintained at pcloadletter.co.uk

PKG_FOLDER="/var/packages/Serviio"
ENGINE_CFG="${PKG_FOLDER}/target/bin/serviio.sh"
ENGINE_SCRIPT="${PKG_FOLDER}/target/bin/serviio.sh"
PID_FILE="${PKG_FOLDER}/target/serviio.pid"
DNAME="Serviio"
DLOG="${PKG_FOLDER}/target/log/serviio.log"
COMMENT="# Synology Serviio Package"
TIMESTAMP="`date "+%F %X,000"`"
source /etc/profile
source /root/.profile


EnvCheck ()
#updates to DSM will reset these changes so check them each startup
{
  #/root/.profile should contain 2 lines added by this package tagged with trailing comments
  COUNT=`grep -c "$COMMENT$" /root/.profile`
  if [ $COUNT != 2 ]; then

    #remove any existing mods
    sed -i "/${COMMENT}/d" /root/.profile

    #add required environment variables
    echo "export FONTCONFIG_FILE=fonts.conf ${COMMENT}" >> /root/.profile
    echo "export FONTCONFIG_PATH=${PKG_FOLDER}/target/config/fonts ${COMMENT}" >> /root/.profile
  fi
}

start_daemon ()
{
  EnvCheck
  source /root/.profile

  #create/refresh fontconfig cache - prevents delay the first time that FFmpeg renders hard subs
  #FC_DEBUG=128 fc-cache --verbose
  ${PKG_FOLDER}/target/bin/fc-cache

  #refresh hostname in Serviio instance name - recently DSM has modified the hosts file and broken localhost name resolution
  sed -i -r "s%<FriendlyName>Serviio \((\{computerName\})\)%<FriendlyName>Serviio \(`hostname`\)%" $PKG_FOLDER/target/config/profiles.xml

  #set appropriate Java max heap size
  RAM=$((`free | grep Mem: | sed -e "s/^ *Mem: *\([0-9]*\).*$/\1/"`/1024))
  if [ $RAM -le 128 ]; then
    JAVA_MAX_HEAP=80
  elif [ $RAM -le 256 ]; then
    JAVA_MAX_HEAP=192
  elif [ $RAM -le 512 ]; then
    JAVA_MAX_HEAP=384
  #Serviio's default max heap is 512MB
  elif [ $RAM -gt 512 ]; then
    JAVA_MAX_HEAP=512
  fi
  sed -i -r "s/(^..JAVA.) -Xmx[0-9]+[mM] (.*$)/\1 -Xmx${JAVA_MAX_HEAP}m \2/" "${ENGINE_CFG}"
  echo "${TIMESTAMP} Starting ${DNAME}" >> ${DLOG}
  ${ENGINE_SCRIPT} > /dev/null 2>> ${DLOG}
  if [ -z ${SYNOPKG_PKGDEST} ]; then
    #script was manually invoked, need this to show status change in Package Center
    [ -e ${PKG_FOLDER}/enabled ] || touch ${PKG_FOLDER}/enabled
  fi
}

stop_daemon ()
{
  echo "${TIMESTAMP} Stopping ${DNAME}" >> ${DLOG}
  kill `cat ${PID_FILE}`
  wait_for_status 1 20 || kill -9 `cat ${PID_FILE}`
  rm -f ${PID_FILE}
  if [ -z ${SYNOPKG_PKGDEST} ]; then
    #script was manually invoked, need this to show status change in Package Center
    [ -e ${PKG_FOLDER}/enabled ] && rm ${PKG_FOLDER}/enabled
  fi
}

daemon_status ()
{
  if [ -f ${PID_FILE} ] && kill -0 `cat ${PID_FILE}` > /dev/null 2>&1; then
    return
  fi
  rm -f ${PID_FILE}
  return 1
}

wait_for_status ()
{
  counter=$2
  while [ ${counter} -gt 0 ]; do
    daemon_status
    [ $? -eq $1 ] && return
    let counter=counter-1
    sleep 1
  done
  return 1
}

case $1 in
  start)
    if daemon_status; then
      echo ${DNAME} is already running with PID `cat ${PID_FILE}`
      exit 0
    else
      echo Starting ${DNAME} ...
      start_daemon
      exit $?
    fi
  ;;

  stop)
    if daemon_status; then
      echo Stopping ${DNAME} ...
      stop_daemon
      exit $?
    else
      echo ${DNAME} is not running
      exit 0
    fi
  ;;

  restart)
    stop_daemon
    start_daemon
    exit $?
  ;;

  status)
    if daemon_status; then
      echo ${DNAME} is running with PID `cat ${PID_FILE}`
      exit 0
    else
      echo ${DNAME} is not running
      exit 1
    fi
  ;;

  log)
    echo "${DLOG}"
    exit 0
  ;;

  *)
    echo "Usage: $0 {start|stop|status|restart}" >&2
    exit 1
  ;;

esac
 

ffmpeg-wrapper-i686evansport.sh

#!/bin/sh

#FFmpeg wrapper script to enable hardware decoding and encoding on Intel Evansport CPUs
#wrapper originally posted here: http://forum.serviio.org/viewtopic.php?f=7&t=6458

FOLDER="`dirname $0`"
PARAMS=""
COMMANDLINE=$@
FFMPEG_BIN="ffmpeg"
INPUT=0
for PARAM in "$@"; do
  if [ ${INPUT} = 1 ]; then
    #the FFmpeg input filename/URL needs quotes adding back on
    #because it may contain spaces, and the shell has removed them
    PARAMS="${PARAMS} \"${PARAM}\""    
    INPUT=0
  elif [ ${INPUT} = 2 ]; then
    #the FFmpeg subtitles filename needs quotes adding back on
    #because it may contain spaces, and the shell has removed them
    PARAM=${PARAM/\[*.*\]subtitles=filename=/subtitles=filename=\"}
    PARAM=${PARAM/:original_size/\":original_size}
    PARAMS="${PARAMS} ${PARAM}"    
    INPUT=0
  elif [ "${PARAM}" == "-filter_complex" ]; then
    #next parameter will be subtitles filtergraph including subtitle filename
    #which needs special treatment, so set a flag
    INPUT=2
    PARAMS="${PARAMS} ${PARAM}"
  elif [ "${PARAM}" == "-i" ]; then
    #next parameter will be input filename which needs special treatment, so set a flag    
    INPUT=1
    #enable hardware decoding by default, but not when Serviio is either:
    # gathering media metadata,
    # remuxing video,
    # generating thumbnails,
    # or rendering subtitles into the video stream (pipeline mode not supported for subs),
    if [ $# -lt 3 ] || \
       [ "${COMMANDLINE}" != "${COMMANDLINE/ -c:v copy /}" ] || \
       [ "${COMMANDLINE}" != "${COMMANDLINE/ pipe:/}" ] || \
       [ "${COMMANDLINE}" != "${COMMANDLINE/ -filter_complex \[*:*\]subtitles=/}" ]; then
      PARAMS="${PARAMS} -i"
    # or gathering online stream metadata 
    elif [ $# -eq 4 ] && [ "${COMMANDLINE}" != "${COMMANDLINE/-analyzeduration /}" ]; then
      PARAMS="${PARAMS} -i"
    else
      PARAMS="${PARAMS} -prefer_smd -i"
    fi
  else
    PARAMS="${PARAMS} ${PARAM}"
  fi
done

#older Evansport FFmpeg version 2.7.1 needs "-strict -2" to use experimental aac encoder
if [ "${PARAMS}" != "${PARAMS/ -c:a:* aac /}" ]; then
  PARAMS="${PARAMS/ aac / aac -strict -2 }"
fi

#Is this FFmpeg commandline a candidate for the hardware encoder?
HWENC=0
if [ "${PARAMS}" != "${PARAMS/ -c:v libx264 /}" ]; then
  #check whether H.264 encoder is already busy with another Serviio/VideoStation session
  PID_HWENC=`cat /tmp/VideoStation/enabled 2> /dev/null | sed -r "s/.*\"PID\":([0-9]+),\"hardware_transcode.*$/\1/;s/\[//;s/\]//"`
  #is there an indicated PID?
  if [ -n "${PID_HWENC}" ]; then
    #there is an indicated PID - is it running? 
    if ! kill -0 ${PID_HWENC}; then
      #the indicated PID is not in fact running, HW encoder is therefore available
      rm /tmp/VideoStation/enabled
      #make hardware H.264 encoder substitution to replace libx264
      HWENC=1
    fi 
  else
    #there is no indicated PID, HW encoder is therefore available
    HWENC=1
  fi  
fi

if [ ${HWENC} = 1 ]; then
  #make hardware H.264 encoder substitution to replace libx264
  PARAMS=${PARAMS/ libx264 / h264_smd }

  #by default Serviio's libx264 transcoding is intended for speed over quality, with SMD we can opt for better quality
  PARAMS="`echo ${PARAMS} | sed -r "s/ -crf [0-9]+ / /; s/ -g [0-9]+ / /"`"
  PARAMS=${PARAMS/ -preset:v veryfast / }
  PARAMS=${PARAMS/ -profile:v baseline / -profile:v high }
  PARAMS=${PARAMS/ -level 3 / -level 4.1 }
fi

#invoke FFmpeg
#log commandline, except media probes
#[ $# -gt 2 ] && echo "${FOLDER}/${FFMPEG_BIN} ${PARAMS}" >> ${FOLDER}/../log/ffmpeg-wrapper.log

#need to use eval here otherwise the quotes aren't handled properly
#http://fvue.nl/wiki/Bash:_Why_use_eval_with_variable_expansion%3F
eval ${FOLDER}/${FFMPEG_BIN} ${PARAMS}

#return FFmpeg status
exit $?
 

Changelog:

  • 0037 05/Jun/19 – Updated to Serviio 2.0, clear your web browser cache to fix Serviio Console issues
  • 0036 17/Apr/19 – Updated to Serviio 1.10.1, fixed missing Serviio console icon in DSM 6.2 main menu, added support for DS119j
  • 0035 14/May/18 – Updated to Serviio 1.9.2
  • 0034 01/Mar/18 – Updated to Serviio 1.9.1, added ARMv8 support
  • 0033 02/Aug/17 – Updated to Serviio 1.9
  • 0032 21/Jan/17 – Fixed Evansport FFmpeg wrapper script to allow transcoding to aac since it’s an older FFmpeg version with slightly different command syntax
  • 0031 07/Jan/17 – Updated to Serviio 1.8
    Updated FFmpeg to 3.2.2
    Updated Intel Evansport hardware transcoding build of FFmpeg from 2.0.2 to 2.7.1 – now detects H.265 codec correctly
    Fixed Intel Evansport FFmpeg support for transcoding DTS audio
    FFmpeg now uses hard float ABI on systems with Armada 370/XP SoC (DSM 6.0 change)
    FFmpeg now uses NEON on systems with Armada 375 SoC (DSM 6.0 change)
    Disabled FFmpeg wrapper script to enable libshine for ARMv5 systems now that Serviio handles this automatically
    Added Ogg Vorbis audio support to FFmpeg
    Updated Deja-Vu fonts to 2.37
    DSM 6.0 is now required due to greatly simplify FFmpeg compilation
  • 0030 21/May/16 – Updated to Serviio 1.6.1
  • 0029 28/Jan/16 – Updated to Serviio 1.6, integrated the new built-in web console into DSM, fixed stupid wrapper bug which had broken evansport hardware transcoding on DS214play and DS415play, fixed online content when using evansport build. You must have already upgraded to version 1.5.2-0028 or else Package Center will report a TCP port conflict and will fail to upgrade the package. If you missed the 0028 update, install it manually in Package Center using the .spk file: (DS214play/DS415play), (all other models).
  • 0028 08/Jan/16 – Serviio instance uses hostname rather than localhost, more accurate detection of DSM 6.0 on Intel CPUs which need x64 FFmpeg build, added DS216play support, fixed missing libgmp on DS3612xs running DSM 5.0, change to allow easy package upgrade to forthcoming Serviio 1.6
  • 0027 12/Nov/15 – Substantial package re-write hence the long delay since the last release
    Completely refreshed documentation, please re-read
    Updated to Serviio version 1.5.2
    Java 8 is now required – this is a Serviio imposed requirement
    DSM 5.0 or newer is now required
    Updated to FFmpeg 2.7.1 and many libs e.g. x264 at latest versions from late July 2015
    Added optional hardware transcoding support for Intel Evansport systems (DS214play, DS415play) built using Synology-modified sources for FFmpeg 2.0.2
    FFmpeg is now compiled with https support via GNUTLS library (useful for online streams via plugins)
    Switched to using root account which was necessary for Evansport hardware encoding ā€“ no more adding account permissions, package upgrades will no longer break this
    Added support for Mindspeed Comcerto 2000 CPU (comcerto2k ā€“ ARM Cortex-A9 with NEON) in DS414j
    Added support for Intel Atom C2538 (avoton) CPU in DS415+
    Fontconfig fc-cache utility now included to allow troubleshooting issues with adding new fonts for additional subtitle language support
    Fontconfig variables checked on each package startup so DSM upgrades no longer break hard subs support
    Updated DejaVu subtitle font to version 2.35
    DSM Firewall application definitions added
    Tested with DSM Task Scheduler to allow package to start/stop at certain times of day, saving RAM when not needed
    Daemon init script now uses a proper PID file instead of the unreliable method of using grep on the output of ps
    Daemon init script can be run from the command line
    Improved accuracy of temp folder and plugins folder detection
    Switched to .tar.xz compression for native binaries to reduce web hosting storage footprint
    Package is now signed with repository private key
    User Agent customization while downloading Serviio binaries from serviio.org to allow download stats gathering
  • 0026 25/Mar/14 – Updated to Serviio 1.4.1.2
  • 0025 18/Mar/14 – Updated to Serviio 1.4.1.1
  • 0024 30/Jan/14 – Updated to Serviio 1.4
  • 0023 07/Nov/13 – Updated to FFmpeg 2.1 stable release
  • 0022 30/Oct/13 – Added support for Intel Atom Evansport and Armada XP CPUs in new DSx14 products
  • 0021 18/Oct/13 – Fixed zlib linking issue in QorIQ and Intel builds of FFmpeg
  • 0020 05/Sep/13 – Updated to Serviio 1.3.1
  • 0019 25/May/13 – Added support for Armada370 SoC used in DS213j (ARMv7 CPU with FPU)
  • 0018 29/Mar/13 – Updated to Serviio 1.2.1, recompiled FFmpeg to use the libRTMP source code from serviio.org for consistency
  • 0017 01/Mar/13 – Updated to Serviio 1.2
  • 0016 23/Jan/13 – Fixes for DSM 4.2
  • 015 30/Dec/13 – Updated to Serviio 1.1, fixed garbled ac3 encoding issue on ARM CPUs by compiling FFmpeg natively, rather than cross compiling. Remember to update your computer’s Serviio Console to 1.1 before connecting to manage.
  • 014 28/Oct/12 – Added support for Freescale QorIQ PowerPC CPUs used in some Synology x13 series products, switched to shared library compile of FFmpeg with some minor changes, ARM build now uses libshine encoder which allows realtime audio transcoding to MP3, edited FlowPlayer config to play AAC audio natively to make MediaBrowser more usable with online feed items.
  • 013 Fixed a bug in the plugins folder creation, fixed deletion of home directories after user deletion (DSM 4.1)
  • 012 Reduced Java prefs checking interval to once every 24 hours to allow the NAS to hibernate (was 30 seconds by default – remember to increase the time between library refreshes if you want hibernation)
  • 011 Updated Serviio to 1.0.1, slightly altered how the plugins folder path is determined
  • 010 Updated to Serviio 1.0, removed WebUI, FFmpeg wrapper no longer needed on ARM, plugins folder moved to /volume1/public/serviio/plugins to make adding/updating plugins easier
  • 009 Installation fails unless User Home service is enabled, unified the installer scripts, merged ARM and Intel packages into one which downloads the FFmpeg binary separately, used integer maths Dolby AC-3 encoder on ARM systems (no floating point)
  • 008 Fixed DST timezone support, installer no longer assumes /volume1 is primary storage volume
  • 007 Updated Serviio to 0.6.2, kairoh’s WebUI to 0.6.2c, changed package to download Serviio from the official website during installation, temp path is set by default to /volume1/@tmp on first run, and finally some CSS improvements
  • 006 Updated to Serviio 0.6.1, switched to kairoh’s Java WebUI, added timezone support, removed DSM icon when Serviio is not running, adjusted Java max heap size for systems with low RAM, specified FFmpeg path directly rather than creating a symlink in /bin so as not to interfere with other packages which may use different versions of FFmpeg
  • 005 Added Web Station dependency, EULA dialog, and links for Web UI and user forum in More Info
  • 004 Test for package repo to allow update notification
  • 0.6.0.1 v3 Hopefully fixed an issue with the Serviio DSM icon in DSM 3.2 on NAS units without Optware installed
  • 0.6.0.1 v2 Inclusion of a modified version of the PHP Web UI
  • 0.6.0.1 v1 New minor Serviio release 0.6.0.1 with some updated international translations – will upgrade 0.6 preserving the media library
  • 0.6 v1 23/Sep/11 – First public release – Serviio 0.6
  • 0.6b4 v2 Fixed permissions on transcode temporary folder following upgrade, avoiding the need for a reboot
  • 0.6b4 v1 Updated to Serviio 0.6 beta 4, added upgrade scripts to allow media database migration (install future packages over the top of this one – database is preserved)
  • 0.6b3c v2 Fixed HOME env var for serviio user (to fix librtmp issues with BBC iPlayer) and removed the need to edit the passwd file to change the shell (safer)
  • 0.6b3c v1 Initial spk test release – Serviio 0.6 beta 3

 
 

1,499 thoughts on “Serviio 2.0 package for Synology NAS

  1. Barrin

    Hi,

    I’ve got problem with DSM 6.0 beta – and 1.5.2 Serviio – it installed without any error, but when it come’s to process movies it shows ‘[MetadataExtractionCoordinator] Skipping processing metadata for an unsupported fi;e (/blah/blah/path/movie.mp4) Message: Unknown video file type.

    Any way to fix it? :)

    Reply
      1. Barrin

        ‘/var/packages/Serviio/target/bin/ffmpeg: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory’
        Model: DS412+
        Soft: DSM 6.0-7135
        INTEL Atom D2700

      2. patters Post author

        I think this will be related to DSM 6.0 userspace becoming 64bit on 64bit CPUs. Try this:

        cd /volume1/@tmp
        mkdir test
        cd test
        wget http://packages.pcloadletter.co.uk/downloads/serviio1.5-native-x64.tar.xz
        tar xvJf serviio1.5-native-x64.tar.xz
        ./ffmpeg

      3. Barrin

        After everything:

        root@Qfer:/volume1/@tmp/test#./ffmpeg
        ffmpeg version 2.7.1-compiled_by_patters_for_Serviio Copyright (c) 2000-2015 the FFmpeg developers
        built with gcc 4.7.3 (crosstool-NG 1.18.0) 20130102 (prerelease)
        configuration: –arch=x86 –enable-cross-compile –cross-prefix=/usr/local/x86 _64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- –target-os=linux –prefix=/usr/local/ x86_64-pc-linux-gnu –enable-shared –disable-static –enable-pic –disable-ffpl ay –disable-ffserver –disable-debug –enable-pthreads –enable-libmp3lame –en able-librtmp –enable-libass –enable-libspeex –enable-gpl –enable-libx264 –e nable-gnutls –pkg-config=pkg-config –extra-version=compiled_by_patters_for_Ser viio
        libavutil 54. 27.100 / 54. 27.100
        libavcodec 56. 41.100 / 56. 41.100
        libavformat 56. 36.100 / 56. 36.100
        libavdevice 56. 4.100 / 56. 4.100
        libavfilter 5. 16.101 / 5. 16.101
        libswscale 3. 1.101 / 3. 1.101
        libswresample 1. 2.100 / 1. 2.100
        libpostproc 53. 3.100 / 53. 3.100
        Hyper fast Audio and Video encoder
        usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfi le}…

        Best regards,

      4. patters Post author

        Great, thanks for that. I’ll need to work out some way to have the package figure out if DSM is 64bit. Can you run this?
        ls /lib64/libz.so.1

        In the meantime you can fix your existing Serviio install by doing:
        mv /volume1/@tmp/test/* /var/packages/Serviio/target/lib/
        mv /var/packages/Serviio/target/lib/fc-cache /var/packages/Serviio/target/bin/
        mv /var/packages/Serviio/target/lib/ffmpeg /var/packages/Serviio/target/bin/

      1. Juergen

        Maybe a dumb question, but i updated my Syno with the first version of 1.5.2 and it`s working without problems. Should i use the newer version, too?

      2. Marc LĆ©onard

        Still need help…
        Serviio is installed but now I have another issue with the video scanning. For each of them, the log shows “skipping processing metadata for an unsupported file”. My model is DS415+
        Thanks

      3. patters Post author

        Can you run this from an SSH session running as root and reply with the output:
        /var/packages/Serviio/target/bin/ffmpeg

        and also:
        ls /lib64/libz.so.1

        Which version of DSM are you using?

        Thanks

      4. Marc LĆ©onard

        The output:
        /var/packages/Serviio/target/bin/ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory

      5. Marc LĆ©onard

        Here is the results:
        /root$ ls /lib/libz.so.1
        /lib/libz.so.1
        /root$ ls /lib64/libz.so.1
        /lib64/libz.so.1

      6. Marc LĆ©onard

        /root$ ls /lib/libmp3lame.so.0
        /lib/libmp3lame.so.0
        /root$ ls /lib64/libmp3lame.so.0
        ls: /lib64/libmp3lame.so.0: No such file or directory
        /root$ ls /lib/libexpat*
        /lib/libexpat.so
        /lib/libexpat.so.0
        /lib/libexpat.so.1
        /lib/libexpat.so.1.6.0
        /root$ ls /lib64/libexpat*
        ls: /lib64/libexpat*: No such file or directory

    1. patters Post author

      Update DSM first. Stop Serviio. Uninstall Java. Install Java 8. Finally update Serviio via Package Center. As long as you don’t uninstall Serviio your library will be preserved.

      Reply
  2. ŠŠøŠŗŠøтŠ° (@Teutonick)

    How to update library automatic?
    I have checked keep library updated in console, but after few days new video file dont add in my folder on DLNA … ((
    p.s. i think there is no need to start console any time when i add something video to device ? it can update on background ?

    Reply
  3. don kiskouli

    fyi: installed on a ds415+ – dsm 5.4
    just needed to add the oracle java file
    all seems to be ok: good work :)

    Reply
  4. Protin Jean-Pierre

    Hello

    Thank you for your Job

    I am trying to download Package but followin msg appear :

    Not Found

    The requested URL /downloads/serviio1.5-native-x86_64.tar.xz was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    What’s wrong ?

    Regards

    JP

    Reply
  5. Bryon

    Dumb question. How do I set the Serviio password on DSM 6 Synology DS412+. Fresh install. I tried the Remote Console but it won’t connect and I know I’m using the correct ip address 192.*.*.145. Do I need to add the port?

    Reply
    1. patters Post author

      The Console is an application you need to install on a computer, it’s not a web page. Check over the instructions on here again – the required steps are explained.

      Reply
  6. MAR

    Hi, I’am looking for the old 0.6.2.c version for my DSM3.2. I don’t wan’t to updated my NAS, it’s working without any problem…. Can’t find a donload link on any place

    Reply
    1. patters Post author

      I’m afraid I don’t have sufficient web hosting to host the older versions (in particular their FFmpeg binaries). I’m on a very cheap plan with limited storage.

      Reply
  7. Nick_Nick

    Hi, I try to install serviio to my DS415+ but it doesn’t work. :-(
    I get the message that the Location is invalid.

    Reply
      1. Nick_Nick

        Hi Patters,

        yesterday I could add the packages source (I’ve tried it many times).
        And following I had problems to install java 8 and serviio.
        But after the 10th try it worked.

        So now, serviio runs on my NAS and Iā€™m very happy.

        I donā€™t know what the problem was. I suppose it was a bad internet connection which caused the problem.

        Best regards,
        Dietmar

  8. Koalinho

    Hello Patters,

    I added a new profile on my Synology 713+ for my new Samsung TV UE65JS9500 (Tizen) in order to enable all my srt subtitles for avi and mkv container. But I have no idea what I should do to make it work. Some AVI and MKV files work with SRT file but the majority does not.

    The ones that work have this information added in the container files (see below) and the ones that don’t have this information do not work.

    Text
    ID : 3
    Format : UTF-8
    Codec ID : S_TEXT/UTF8
    Codec ID/Info : UTF-8 Plain Text
    Title : English
    Language : English
    Default : Yes
    Forced : No

    Do you have any advise on how I can make this work and what I should add to the new profile?

    Thanks for your help and great work with the Serviio.

    Cheers
    Koalinho

    Reply
    1. patters Post author

      Hi Koalinho, I’m afraid I don’t have a Samsung TV so I’m not familiar with its functions but some TVs can only show SRTs inside MKV files, but may not show them when the files are separate. This would be because when they are inside the MKV Serviio is not involved – the TV is reading them directly from the MKV data. When they are provided separately by Serviio they are offered as a separate DLNA resource, which not all TVs will support. The easiest solution for you will probably be to manually edit your MKVs with a tool to add your chosen subtitles.

      Reply
      1. Koalinho

        Hello Patters,

        Thanks for your reply.
        The funny thing is that I had the same problem with my older Samsung TV UE40F7080 but then I chose the right profile “Samsung TV / player (E/F series)” in Serviio and all my external srt file worked again. So, there must be a way. Don’t you think?

        In case you have another idea or contact please let me know.

        Regards,
        Koalinho

  9. Jeff

    This works great, however, when selecting this from my Samsung, it displays Serviio Localhost instead of Server and the real host name of my Synology. Is there way to get it to pull the correct name?

    Reply
    1. patters Post author

      Yes, I’ll fix that in the next minor update. Synology changed something in the hosts file in newer DSM versions I think. I put the old 1.4.1.2 package on to test and it was doing the same.

      Reply
      1. Jeff

        I figured out how to fix this. I edited the /etc/hosts file and found the first line had “xxx.xxx.xxx.xxx localhost”, followed by the second which had “xxx.xxx.xxx.xxx hostname”. I just deleted the first line and rebooted, now it correctly shows the real hostname on my TV.

      2. patters Post author

        I decided not to take that approach since it may break something for DSM. This localhost line wasn’t in the hosts file in older DSM versions – it’s Synology that have added it. I’ve played it safe in the latest package release 0028 which will amend the hostname in Serviio’s profiles.xml config file each time the package starts.

  10. Giansi63

    Hi,

    is there any way to install the new Serviio on an old DS209? You say we need DSM5.0 but unfortunately I’m stuck with DSM4.2. My Diskstation works fine and so does Serviio 1.4.2, but I would like to upgrade to this new release and I don’t need a new Diskstaion.

    Any way around this?

    Reply
    1. patters Post author

      I’m afraid not. FFmpeg is compiled to rely on certain libraries that exist only on the newer DSM versions, and some of the system commands behave differently on the older machines. It’s not really feasible for me to support 7 year old units.

      Reply
  11. Peter Fletcher

    Greetings Patters;
    I am only writing to say how much all of us appreciate the amazing amount of effort you’ve expended on this, and “Thank You”! Incidentally, you can add the DS1515+/DSM5.2 to the list of tested and working platforms.

    Reply
  12. Juraj

    Doesn`t work on my DS216play :( I can`t install Serviio, it is not in my list of packages. Java 8 SE installed, but Serviio is not in the list. I also think about Universal Media Server, but it seems that they do not have support for Synology DS..

    Reply
    1. patters Post author

      I’m very close to releasing Serviio with DS216play support. I got sidetracked making the SANE Backends package, which is done now.

      Reply
      1. Juraj

        This information made my day :) thank you very much. Can I ask, “very close” is what kind of time period – hours, days, weeks?

  13. Nick_Nick

    Hello Patters,

    is the DS415+ supported by your Serviio version 1.5.2?
    If yes, how can I install it? The way you discribe above, doesn’t work.

    If not, do you have an old version who could be installed?
    And do you have a download-link for this old version?

    Regards and happy holidays!
    Nick

    Reply
  14. seb

    hello i have install java 8 and serviio but it can’t start. (i have 215j) when i clic on start nothing happen.

    Reply
  15. al9000

    After adding the remote string to the info.plist the console doesn’t open anymore.

    After the edit it looks like this:

    JVMOptions

    -Dserviio.remoteHost=192.168.0.111

    Is this correct? I’m sure the console was working before adding the string.

    Reply
  16. Harosz

    Hi great job, waitig on serviio for ds216play to, my Samsung tv dont see data streaming from klasik media server any way. Serviio on pc worked excellently with this tv some years. I hope it will be same on NAS :)

    Reply
  17. Desty

    Hey, is it possible to get any older version of Serviio? I have DS214se which doesn’t support Java 8, I think…

    Reply
      1. Desty

        Hey, Java 8 is not showing up in repo. Also tried with manual install via package manager but no luck.

      2. Desty

        Heh, I was checking the “All aplications” section in package manager, not the “Community” section, thats why Java didn’t show up. Now Serviio works perfectly! Thanks! :)

  18. Klaus

    Hello,
    i would like update the Serviio to the newest version 1.5.2, but i donā€™t get to install the Java 8 on my nas. It’s a DS1813+ NAS with DSM 5.2

    If itā€™s possible to get the older version 1.4.x to install the old version while I get solution for this problem.

    Kind regards

    Reply
    1. patters Post author

      That system should offer Java 8 in the repository, it’s a regular Intel Atom D2700. It would not have been possible before DSM 5.0, but you’re on 5.2.
      It should be listed in the Community section in Package Center.

      Reply
  19. Alex

    Hey, I installed Serviio 1.5.2 on my Synology DS115. Great Product! BUT
    The DS115 doesn’t hibernate If library refresh is On. Could You help me?
    ThanX

    Reply
    1. patters Post author

      Hi, unfortunately that’s a long standing issue. Your best option might be the Serviio forum, since I would imagine that it affects all NAS systems – not only Synology. Now that Serviio 1.5 uses Java 8’s OS-native file watching it ought to be possible to have Serviio complying with disk hibernation. I personally haven’t really investigated this because my NAS is active 24/7 since it runs Surveillance Station.

      Reply
  20. Razor

    Hi!

    I’m a Pro user. I’ve been using Serviio Media Server onto a Synology NAS last three years.
    Now, I’ve successfully updated to 1.5.2, but I miss some feature which it was very useful for shared folders so far.
    I mean the capability of enable/disable synchro updates by shared resources individually (a column in Library tab). My question is: What would happen if Serviio try to refresh a shared folder that I have powered off – i.e. a USB disk? In previous versions, Serviio erased all USB entries from its database, so you had to power on USB disk and refresh library again.

    I appreciate your time. Thanks in advance.

    Regards!

    Reply
    1. patters Post author

      Hi, this is more a question for the Serviio forum really since it’s not specific to the Synology version. I’m not familiar with the specifics of file system polling so you’ll get better help there.

      Reply
  21. Neil

    Hi, I’m working with a DS214Play model, latest DSM and Serviio 1.5.2/Java 8 is installed on the NAS. I installed the Serviio console (custom install) on my Win10Pro PC but am not able to connect to the NAS instance to manage it. The console process is running but never actually opens. Any advice?

    Reply
    1. patters Post author

      The Serviio icon hides in the System Tray and you need to right click and select Open Serviio Console from there. Also, the system tray items don’t seem to be shown at all when you’re in Tablet Mode on Windows 10.

      Reply
      1. Neil

        The icon wasn’t initially showing up in the system tray. But I was able to get it going, thanks.

  22. Neil

    I should also mention, the NAS has a static IP and I’ve modified the ServiioConsole.exe.vmoptions file to point to the NAS IP.

    Reply
  23. Protin Jean-Pierre

    Hi

    Now Serviio is working fine on my DS1512

    I am trying to upload Lic File without success : remote Access is not validated.

    Could you help me ?

    Thank you in advance

    Regards

    JP Protin

    Reply
    1. patters Post author

      I have a licence key and I was able to add it via the Console with no issue. I suggest that you post on the main Serviio forum perhaps.

      Reply
  24. Neil

    Could you clarify the process of adding shared folders via the console? I’ve run Serviio for a couple of years, but only from my PC with locally attached storage, so this is a bit of a change.

    I read in a forum post (forum.serviio.org/viewtopic.php?f=14&t=17482&p=93947&hilit=nas+shared+folder+path#p93947) that you need to give the Serviio user access to the shared folders on the NAS, but this Serviio user didn’t exist after installing the app on my DS214play.

    I created the user account and assigned a password, I can see the folder I added, but I’m not seeing any files show up in the media browser, so it still seems like a permissions issue. Clicking Force refresh in the console has no affect.

    Any guidance here would be appreciated…

    Reply
      1. patters Post author

        Good spot. I wrote that in fact :)
        I’ll add that into the main blog post because many people will be confused by this.

  25. Joshua

    I have installed java 8, and serviio 1.5.2 on my synology DS713+ which all worked.
    I am having trouble with the serviio console app on my mac, it is not opening. I can see that the app is active but the window won’t show.

    Ialtered the info.plist file with terminal as described above it saves it into a ‘info.plist.save’ file instead of overwriting the original so I have tried altering the file with text editor and then replacing it.

    I’ve read the instructions several times and can’t see what I am missing/doing wrong.

    How the info.plist file looks at the end:
    JVMOptions

    -Dserviio.remoteHost=10.0.1.78
    -XX:+UseG1GC
    -XX:GCTimeRatio=1
    -XX:MinHeapFreeRatio=5
    -XX:MaxHeapFreeRatio=10
    -Dserviio.home=$APP_ROOT/Contents/Java/
    -Djava.net.preferIPv4Stack=true
    -Dorg.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade

    JVMDefaultOptions

    Xms
    -Xms5M

    JVMArguments

    Reply
  26. fifiloulourou

    hello
    where can i found an older version of serviio can run with java 7 on synology.
    i try tu update to java 8 but my subsonic pakage c’ant start so i install java 7 and subsonic package start
    i need serviio ti use ffmpeg codec tu run video on subsonic so il woul an older version of serviio ru with java7

    Reply
  27. judins

    Hi,

    I have been using Serviio for Synology for a year and a half (version 1.4 I guess, do not remember now). Tried to upgrade to latest 1.5.2. I am using DS713+ (Intel based), on latest DSM.

    What I did:
    1. Uninstalled Serviio
    2. Uninstalled Java 6 Embedded
    3. Installed Java 8, via guide your guide “/java-package-for-synology/”, Java installed and shows as running in packages
    4. Installed Serviio 1.5.3 from “Community” section
    Next is the problem, it shows as installed in Packages, however, when I run it, following few seconds it says “Stopped”.

    I have actually tried to uninstall everything twice, but no luck.

    Here is the screenshot of log: http://take.ms/0asLk
    For reference here is also DiskStation information: http://take.ms/HqdYP

    I wouldn’t mind installing back 1.4 version or so, but can’t find instructions on that anymore.

    Could you please help?

    Thank you!

    Reply
    1. judins

      Figured it out this way: I’ve uninstalled Java and Serviio, restarted system, installed again Java + Serviio, it still didn’t work, I restarted system again (with installed both) – after restart it worked like a charm. Not sure I am the one with this issue, might be helpful for some, to restart system after installation.

      Reply
  28. James

    I must be missing something quite obvious here.
    I have Java and serviio up and running. I have used serviio before using the desktop as a server, but this time I only have the client.
    I have created a shared folder /volume1/dnla/Videos on the Synology and set it up in serviio using the notation /volume1/dnla/Videos
    My TV can see the folder via DNLA, but nothing in it….
    What ever folder I set up, the TV can see, but nothing in it, not pictures or video files
    What am I missing here?

    Reply
  29. Koalinho

    Hello Patters,

    Since I have installed Serviio 1.5.2.0028 update (22.01.2015) on my Synology 713+ I am not able more to play audio files (mp3, wma, etc.) on my new Samsung TV UE65JS9500 (Tizen). Before it was working fine without any problem. Actually, it is the first time this happened!

    Can you please advise what I could do in order to play my whole audio library on my TV.

    Regards,
    Koalinho

    Reply
    1. patters Post author

      Which version did you have before that? There weren’t any profile.xml modifications between 0027 and 0028. Did you upgrade from Serviio 1.4.1.2 perhaps?

      Reply
      1. Koalinho

        I upgraded from 1.5.1.0027 to 1.5.2.0028. I had already the latest software level installed from 1.5.2. What can I do?
        Thanks for your prompt reply.

  30. Koalinho

    I upgraded from 1.5.1.0027 to 1.5.2.0028. I had already the latest software level installed from 1.5.2. What can I do?
    Thanks for your prompt reply.

    Reply
  31. Tony Farlie

    Hi!
    I recently upgraded my Serviio package on my Synology DS415+, not sure of the initial version but it was installed from the Package Manger about a week ago. I saw that to upgrade to 1.6.0-0029 I would have to first upgrade to 1.5.2-0028 as it complained about port 23423 being used. I did this by following copying the .spk from http://packages.pcloadletter.co.uk/downloads/old/serviio1.5.2-merged-0028.spk. This worked fine but I still get the same error message when trying to upgrade to 1.6.0-0029. I can’t find an spk to manually update to version 1.6.0-0029.. Help!!! :)
    Cheers,
    Tony

    Reply
    1. patters Post author

      Try stopping Serviio, removing any firewall rules that you may have defined using the Serviio services, and rebooting the NAS. Then try to upgrade without starting Serviio up. Let me know if that works (it should).

      Reply
      1. Juergen

        I got the same isuue with port in use, advise with restart doesn`t solved the problem, help pls…

  32. John D

    I found the only way to avoid the “port in use” error was to uninstall the older version of Servio in order to install 1.6. Then it seems to work with no issues.

    Reply
    1. Juergen

      I have the same problem, as reported above and i never made any firewall rule on my nas. There is only one rule, wich allows all ports. Comes as default rule?

      Reply
  33. Richard

    I have the same problem as Tony. When you say “removing any firewall rules that you may have defined using the Serviio services”, do you mean that this will happen as a result of stopping Serviio, or that there’s something else I’d need to do manually?

    I:
    – stopped Serviio
    – rebooted the NAS
    – tried to update from 1.5.2-0028 to 1.6.0-0029

    but I still get that same error message.

    Thanks for your help.

    Reply
      1. Richard

        Thanks patters, did that and now successfully updated. Hopefully the next update will go through more smoothly!

  34. nico

    Hello
    I stopped Serviio
    I rebooted the NAS
    I tried to update from 1.5.2-0028 to 1.6.0-0029 , then cannot be Upgrade…

    I finally uninstall Serviio 1.5.2-0028
    and install new version, and It’s Be OK !!
    Good luck for all !

    Reply
  35. Simon Eves

    I had the same problem. Upgraded from 1.4.1.2 to 1.5.2-0028 (upgrading Java to 8u6 first) but wouldn’t let me upgrade again to 1.6. “netstat” showed port 23423 as in use by Java when 1.5.2 was running, and not when it wasn’t. I followed the forum post instructions to retain my library and settings through a manual uninstall of 1.5.2 and install of 1.6, and I’m sure I did it correctly (I use Linux all the time, so completely understand the process of restoring the old /library directory) but on then running 1.6 and looking in the web console, none of my settings were retained. Not a big deal to rebuild them, but I thought I’d let you know… :\

    Reply
  36. Nick_Nick

    I had also the problem to update Serviio.
    The installed Version was 1.5.2-0027.
    My System: DS 415+ with DSM 5.2-5644 Update 3

    My solution was:
    1. update Java8 to the latest Version (8u71) – (uninstall the old and install the new one)
    I don’t know if it’s really necessary, but now the acual Java-Version is installed ;-)
    2. uninstall the old Serviio-package
    3. install the new Serviio-package
    (the installroutine had a problem downloading the needed font (dejavu-fonts-ttf-2.35). So it was necessary to download it manually and copy it to the pulbic folder on the NAS (http://sourceforge.net/projects/dejavu/files/dejavu/2.35/dejavu-fonts-ttf-2.35.tar.bz2/download).

    This worked fine, but the system lost the settings and the media folder.
    But to add the folder and doing the settings was not really a problem …

    And now I’m happy with Serviio 1.6 :-)

    But there is no guarantee that this always works.

    Reply
  37. John D

    The problem I’m having with 1.6 is that the NAS no longer hibernates. It did hibernate with 1.5.2 because I configured no automatic updating (ie only database updates were manual) I can see that a lot of activity with 1.6 seems to come from Java 8, so I’m presuming it’s still acting as if Serviio is set to auto update, even when this is disabled in the settings.

    Would it be possible for you to investigate this, as I’m sure I’ve seen others complaining that the settings for auto-updating are not being respected. I’ve even experienced not being able to access the Serviio server from my TV because the NAS is too busy running Serviio database updates that it shouldn’t be running, and aren’t necessary. Logging in to the NAS sees the CPU pegged to a hundred percent with the Java process showing at the top when there’s nothing else running on the NAS.

    Reply
    1. patters Post author

      Any change in behavior is a Serviio change. I don’t code this software, just package it.
      For what it’s worth, Serviio no longer polls the disk – it investigates inotify events which Java 8 is aware of.
      I don’t have this high CPU activity with mine.
      The sleep issue most likely relates to logging. As I’ve mentioned before in the comments no prior Serviio version has worked with sleep for me and, since I run Surveillance Station on mine, it’s not something I have time to investigate at the moment.

      Reply
      1. John D

        After rebuilding the database, and leaving it for a day, it seems to have calmed down a lot, and it’s sleeping right now. I have the NAS set to aggressively sleep, and it only acts as a media server, so any changes have only come with the new java/Serviio, as it the only thing that has changed.

        There do seem to be some errors/exceptions in the Serviio log related to media and a few other things, so maybe it just kept trying to correct these things until I just force refreshed the database from scratch.

        Thanks for all your hard work getting first 1.5.2 and now 1.6 working – it sounded like a herculean task!

  38. IanFr

    Hi,

    I have the 1.5.2-0028 build installed (and have had since it was made available) but I cannot upgrade to the new 1.6 build due to the error saying that port 23423 is already in use…other than uninstalling everything is there anything I can do ?

    Reply
  39. Grimthorr

    Thanks Patters for your continued work with this!

    I came across the “port 23423 reserved or in use” error, and the easiest way to fix it is as below:
    1. Stop the Serviio package
    2. Connect to your NAS using SSH
    3. Run command: vi /usr/local/etc/services.d/Serviio.sc
    4. Edit line 5 that specifies port 23423 and change it to 23425 or anything else
    5. Update the Serviio package (this will also update the edited file, which changes the port back to 23423)
    6. Run the new Serviio package

    Reply
    1. patters Post author

      I would advise against that. I have experienced issues with orphaned firewall port settings in DSM by editing these in the past. When the package is uninstalled later you’ll likely have issues.

      Reply
  40. TommyGun

    Dumb question perhaps but does it support DTS or DTS to AC3?
    If so; i hope it will become available for the DS216play :)

    Reply
    1. patters Post author

      It already supports DS216play yes. No hardware transcoding yet though (software only). I need Synology to release the source code for DSM 6.0 before I can get started on that. Serviio does indeed support DTS.

      Reply
  41. Nick

    Thanks for all your effort Patters. I’m running version 0027 and am about to update. Do I need to manually install version 0028 before 0029 or can I just click install package update from within DSM Package Manager?

    Thanks.

    Reply
  42. Lovro_Car

    Hello,

    Is there any chance to add support for enigma2 http ts streams?
    I am using Play214 and 1.6 version of Serviio.
    TV is Panasonic Viera TXP65VT65b.

    Serviio itself recognise the stream and will play in vlc (iOS, or mac). However it won’t play on tv.

    Log:

    Reply
  43. John D

    Does 1.6 still do an hourly licence file check, or was that patched out to a more sensible once a day. as with earlier versions?

    Reply
      1. John D

        The reason I asked is that I recall it as something you changed a couple of main versions ago to prevent a NAS from waking up every hour for a licence check. I may be mis-remembering.

      2. patters Post author

        I didn’t change that particular behaviour. I did alter the JVM command line to stop it from loading Java’s prefs frequently. That change is still in.

Leave a comment