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. Petr

    ZdravĆ­m mĆ”m problĆ©m s instalacĆ­ na synology vaÅ” package server nejde tĆ­m pĆ”dem nic nestĆ”hnu

    Reply
  2. John D

    Amazing! Thanks so much for continuing to support Serviio. I know that Synology don’t always make it easy.

    Reply
  3. JaMar

    Hi, after upgrading to version 1.9 I have the following problem: “ERROR [MediaServer] An unexpected error occured. Ending the application. Message: Can not initialize cryptographic mechanism” this will appear a few seconds after the log start, and then the Serviio stops. I have Synology DS214 and DSM 6.1.4-15217 Update 1. Thanks for the help :(
    JaMar

    Reply
  4. Poul Nielsen

    Java for ARMv8 ?

    The history says (above)
    0033 30/Oct/17 ā€“ Added support for new CPU types in x18 products
    I guess htis means that you have started generating it for the new CPU.

    but
    ….
    what about Java?

    There is a discussion in the serviio forum “New DS218play with ARMv8 = Serviio is dead”
    http://www.serviio.org/forum/viewtopic.php?f=14&t=24225&p=116060&hilit=218play#p116060

    I also tried the installation but got suspecious when the Oracle Jave download did not mention ARMv8. I did try both ARM packages but did not succeed. In the end I could confirm the observation in the above link.

    Can you elaborate on your plans for support for the DSx18 series ?

    Reply
    1. patters Post author

      Hi, I have updated both the Java 8 and Serviio packages to support aarch64 (ARMv8) and it’s confirmed working. I do need someone to test registering the hardware H.264 encoder which I think it may be possible to get working. Please see this forum thread.

      Reply
  5. steve

    I also have a DS218play with the ARMv8. I have tried both the 151 Java package linked to by Patters and the 161 package directly from the JAVA site and neither one works. With the 161 package, Serviio will start for a couple of seconds and loads configuration files but then crashes

    Reply
    1. patters Post author

      I have just updated the Java SE Embedded 8 package to add experimental support for the aarch64 architecture in the DS218play. It will prompt you to download the full (not Embedded) JDK 8 which is the only one that seems to have an aarch64 compile. Please can you let me know if it works?

      Reply
    2. patters Post author

      JDK 8 for aarch64 confirmed working, and I have built an aarch64 build of FFmpeg. The package is updated to use this so please can you test. I have one confirmation that it’s working, but I need someone to test the hardware encoder functionality before I can enable it in Serviio. Please see this forum thread for details.

      Reply
  6. jhe

    Is it possible to went back to Oracle Java SE Embedded Version 8 Update 151? IĀ“m getting 502 errors, using ejdk-8u161-linux-i586, with e.g. BicBucStriim…

    Reply
    1. patters Post author

      The alert is Serviio telling you that the version is released in the generic sense. I haven’t yet created a new version of the Synology package because I’m waiting for some technical confirmations regarding the DS218play before I release it.

      Reply
  7. John D

    Patters, I’m trying to install the new 1.9.1 package that has just appeared, but it’s giving me an error on downloading the dejavu font. When trying to download it manually, I just get an error page from Sourceforge (“We can’t process this request – Error 500”).

    Is there any way to go back to the old version or is the install still going to get stuck looking for the font?

    I also found that cancelling the installation at this point that Serviio disappeared from my Synology’s package centre as if it had been uninistalled, and although the files still seem to be there. Synology is show it as not installed. I had the “stuck port” issue that I cured by deleting the /usr/local/etc/services.d/Serviio.sc file, but now the font won’t download/doesn’t exist.

    Reply
  8. John D

    I managed to get the font file from Github and put it on the Synolgy public directory for the Serviio install to pick up and got everything installed. However, it looks like all my settings and database for Serviio are gone and need to be remade.

    Reply
  9. xxxo64

    I got the similar problem as John D. At first when I directly update, it told me the dejavu font couldn’t download. So I downloaded it manually and put it in public folder. Then I tried to apply update again (I didn’t dismiss the update confirmation dialog), this time it said ‘port 23423 conflict’, I don’t know how to solve this problem. So I closed the update dialog and went to Packages, found Serviio disappeared. I tried to install it again, it said ‘port undefined conflict’. I’m stuck now. What can I do?

    Reply
      1. Fred

        I do not know anything about computers. what is the procedure to access the usr file?

      2. fred

        Bonjour John. comment supprimer /usr/local/etc/services.d/Serviio.sc ? Je n’y connais rien, et apparait il faut se connecter en SSH ou FTP. J’y arive avec winscp, mais je ne vois pas ce dossier. Merci

      3. patters Post author

        Salut Fred, le dossier /usr peut se voir uniquement avec le privilege du compte ‘root’. Pour cela il va falloir que tu te connectes par SSH (avec PuTTY) utilisant le compte ‘admin’ de ton NAS. Une fois connecte, il faut tapper “sudo -i” ce qui requiert de nouveau le mot de passe de ton compte admin. Et voila, maintenant tu peux naviguer partout dans le systeme et supprimer ce ficher avec “rm /usr/local/etc/services.d/Serviio.sc”. Fais gaffe avec cet access c’est tres facile de tout casser.

  10. Poul Nielsen

    Success on a DS218play

    I also had problems installing servioo on a DS218play some weeks ago.

    Did try again today version 1.9.1

    followed the instructions above

    Serviio 2.0 package for Synology NAS

    1) did install the Java SE Embedded package first also from the Synology Community packages
    2) followed the instruction that did pop-up and dowloaded from Oracle “1.8.0_161-xxx” as instructed
    3) restarted the [b]Java SE Embedded [/b]package installation which succeded
    4) installed servioo from the Synology Community packages

    worked :-)

    I do not need transcoding which according to the above instruction does not work on the DS218play with Realtek RTD1296 SoC

    Reply
  11. lubos

    Hello,
    I install the serviio to my nas DS218j. When I would like to open this app it is error message that in is not possible to open with Quickconnect. How can I open this app?

    Thank you.

    Reply
    1. patters Post author

      Connecting to your NAS with the QuickConnect address is only useful if you are connecting from outside your home. Serviio won’t work like this because it’s a network service which is independent of Synology DSM, so the port forwarding for the QuickConnect service will not be aware of it.

      To use Serviio locally, connect to DSM in the web browser using the local IP address of your NAS. The Serviio icon in DSM will work correctly if you do that. Configuring Serviio for Remote access is a bit more complicated.

      Reply
  12. John D

    Is anyone else seeing the Serviio “force refresh” process die regularly? When adding files and manually refreshing, nothing happens and nothing is logged except “starting manual refresh”. After stopping and restarting the Serviio server, it works straight away. This has now happened several times since upgrading to the latest version of Serviio and Java.

    I’ve seen it happen a couple of times in the past where the whole process dies, but this time the server is still up and serving media, but the force update seems to just stop working. I use force update after adding files because it’s a very low power device, and allowing Serviio to automatically update means there are periods where Serviio can’t be accessed because the device is busy updating. As this is unnecessary unless I add media, the automatic updating is disabled and I only use force update when needed. Since this version, it seems to need a stop/start every time I want to add media and do a forced refresh.

    Reply
    1. don kiskouli

      hi, quite same for me in 1.9.0… regular crashes (no media serving though) after force refresh needing stop/start of service

      Reply
      1. John D

        You should probably upgrade to the latest version of Serviio and Java and see if the problem is fixed. I doubt Patters is going to look at fixing an out of date version.

  13. Neil C

    @JohnD – this is exactly why I came to this forum, to post this very question. I too have recently updated to the 1.9.1-0034 version of Serviio on my Synology DS416J. Since that update, and I admit I have no proof this is what caused this to start, files newly added to my library will not show up until I stop and restart the program.

    I have the “Keep library automatically updated” always on. Even clicking the “Force refresh” button does nothing.

    I’m getting frustrated at always having to stop/start the program as my DVR adds files to the library almost daily.

    Please, any help??

    Thanks!

    Reply
  14. Poul Nielsen

    I also had the problem of new files not being detected (Synology DS218play)

    There is an alternative way of keeping the file list updated.

    1. Start Serviio console
    2. Open -> Library -> Shared Folders
    3. click EDIT (right side)
    4. Enable “Use the poller mechanism for monitoring this folder”

    Reply
    1. John D

      Doesn’t that stop the NAS from hibernating though? Plus as I explained above, I’ve found that if I let Serviio automatically index files, there are periods where you can’t access the NAS for serving media because it’s busy checking files that haven’t changed.

      Reply
  15. matt

    Having all sorts of problems with Serviio playing DTS laden MKV files from a Synology NAS 216+ii onto my PS3. Keeps coming up with Unsupported Data on the ps3. Plays perfectly well in the MediaBrowser. Also interestingly when i try and it fails in the console it thinks its playing it… its just not delivering it to the PS3. could this be a profile issue??

    Reply
    1. matt

      its not all MKV with DTS only a few… might be something to do with header compression after researching it some more.

      Reply
    1. John D

      Have you tried rebooting or manually stopping/starting serviio? What does it say in the log? It does run here on my 214SE that is running that firmware version,

      Reply
  16. John D

    Serviio 1.9.2 has just been released and that explicitly fixed a bug related to files not being added after 24 hours, so when Patters releases the new version, that problem should be fixed.

    Reply
  17. John D

    Thanks for the quick release Patters! The updating problem seems to be fixed, and on first run Serviio seemed to do quite a bit of database tidying up.

    Reply
  18. Neil C

    YAY!!!
    Library is now being kept up-to-date automatically! No more stop/start cycles!
    Thank you!!

    Reply
  19. nbat42

    HI Patters,

    So I have followed your instructions installing Java 171 and then installing Serviio. When I try to run Serviio….nothing happens. Thoughts on how I might trouble shoot. I have a DS916+.

    Thanks for your help in advance.

    Reply
  20. Canorus

    HI Patters,
    I recently bought DS1618+ .
    And set “packages.pcloadletter.co.uk” to DSMā€™s Package Center.
    But, I can find “OpenRemote” only.
    How do I install Serviio?
    Thanks for your help in advance.

    Reply
    1. patters Post author

      It appears that this model has a Denverton CPU (Intel Atom C3538). I have added support for this CPU for Serviio and for the Java 8 Embedded Package.

      Reply
  21. El Jub

    Hello,

    Since the last update from Synology, serviio does not run anymore

    Here is the serviio log error :
    @appstore/Serviio/log$ cat serviio.log
    2018-08-04 23:25:55,000 Starting Serviio
    Unrecognized option: –add-modules
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.

    I downloaded the last Java version but my Synology sees only version 8 update 171 and not the 181 which is the latest

    Reply
  22. Grant Hopper

    I have a Synology DS1815+ and Serviio 1.9.2 (with Java 171) had been running great until I applied DSM 6.2-23739 Update 2. Serviio shows as installed, but won’t run. I tried reinstalling both Serviio and Java with no change in result.

    The burn is there seems to be no way to roll back the update to DSM 6.2-23739 (plain) which was the last configuration (and worked) before the update (Update 2) that seems to have killed Serviio function.

    Any solutions?

    PS: I’m really bummed since Serviio is so awesome and reliable that we use only it to watch media (no cable, etc.)

    Reply
    1. patters Post author

      This is strange because my DS214play is running that same DSM version with no problems. I see from the Serviio forum that the issue seems to be that the Java executable will no longer start. I wonder if this is a 32/64bit issue – perhaps the Synology developers have made a change that is preventing the 32bit Java Embedded from running. The CPU in my NAS is unique in that it’s a 32bit only chip (so maybe that’s why it still works), whereas pretty much every single other Intel Syno runs a 64bit build of Linux. I will update the Java package with a 32/64bit selection for Intel x64 capable CPUs. Let’s see if that fixes it.

      Reply
      1. Grant Hopper

        Thank you! You had me wondering if I should uninstall the Java I had installed (ejdk-8u171-linux-i586.tar.gz) and find a way to limit this thing to 32 bit.

        I’ll look forward to hearing what develops from this.

      2. patters Post author

        The Java package is now updated to offer a choice of SE Embedded or full SE on 64bit Intel CPUs. Please can you confirm it’s working ok as I don’t have an x86_64 NAS to test. Thanks.

      3. nbat42

        Thanks man. I like Serviio and I’m bummed they don’t support it better for Synology Products. I may just switch over to PLEX :(.

        Really appreciate your help. Best.

      4. Grant

        Sorry for the delay in replying. Just got home from a multi day trail race and recovered enough to actually do things.
        Patters, I feel dumb having to ask this, but I’m not sure specifically what I should do in response to “The Java package is now updated to offer a choice of SE Embedded or full SE on 64bit Intel CPUs.”
        I’m not sure if you mean I need to reinstall Java (I’m assuming not since it’s coming from their site so not something you’d be able to update…), or update something else.
        Thanks for any guidance you offer.

      5. Grant

        I should have waited a bit longer. The penny dropped and i figured out what you meant and what I needed to do.

        But, I hit a wrinkle. Just like in the past, I went to the “JAVA SE EMBEDDED DOWNLOADS” page, downloaded “ejdk-8u181-linux-i586.tar.gz” and copied it to the public folder, right along side the last two Java embedded packages from Oracle. Ran the Java SE Embedded 8 installer and got an error message that the installer could not find: “jre-8u181-linux-x64.tar.gz.

        Does this mean that I need to switch from the Java SE embedded package to the Java SE runtime package?

  23. Carlos Ramos

    Seems to run fine with the dev tools install of Java 8. I installed that first and then I installed the Serviio package and it seems to run correctly. I have to do more testing to see if it is stable.This may a good alternative, since Oracle is no longer going to support an embedded java version.

    Reply
    1. El Jub

      Hi,
      Thanks for this tip, I just tried and Serviio is running
      I will test if it plays correctly this evening

      Regards,
      Julien

      Reply
  24. Nicolai

    Hi,
    I still can’t get it to work :( Serviio stops immediately after pressing run, I tried updating with the latest java package you made Patters.
    I can get limited functionality when installing the java 8 dev tools.
    I’m running on a DS214+.
    Regards,
    Nicolai

    Reply
  25. Meelis

    Hello,
    Is there any update for synology are coming? 1.10.1
    I need to have version 1.10.1 new transcoding elements in synology version.
    “maxWidth” “maxHeight” “widthGreaterThan” “heightGreaterThan”

    Reply
  26. Mark

    Hi there, just thought I would post my recent experience. For some reason since I migrated all my data from /volume1 to /volume 3 the indexing process would fall over and Photostation would stop seeing any new photos I put on the server. After I contacted support they stated it was because if the inotify value used by Serviio and they offered to change it so it did not conflict. However, when I asked for further information they declined to be any more specific, so I thought I would share my issue here in case other people come across the same problem.

    Reply
    1. Mark Payne

      Hi Patters, I have the same problem as last year with conflicting inotify values between photostation and serviio. Do you know how I can change and fix this? I had a dig around but didnā€™t see anything obviousā€¦.

      Reply
      1. Mark Payne

        OK, this time I got a better response from Synology. They stated ā€˜We find that another file needs to modified to make the changes works. It must modify the inotify number on both file: /etc.defaults/sysctl.confā€ and ā€ /etc/sysctl.conf ā€˜.

        Looking at this file the constant is ā€˜fs.inotify.max_user_watches=32768ā€™

        Hope this helps others šŸ™‚

  27. Petr Zatloukal

    DobrĆ½ den,
    mĆ”m dotaz ohledně Serviio 1.10.1 , budete tento update aktualizovat pro Synology NAS ?

    Byl bych rĆ”d, děkuji Petr Zatloukal FrĆ½dek-MĆ­stek CZ

    Reply
    1. patters Post author

      Hi, I have published an updated version of the package. I should point out that I am not Petr the Serviio developer, and I don’t speak Czech :)

      Reply
  28. John D

    Thanks for the update Patters! Itā€™s much appreciated, especially as I know the Synology guys are not your favourite people at the moment.

    Itā€™s also worth mentioning that your new Java version (8u201) has been superseded already by Oracle by version 8u211. Anyone installing it for Serviio is going to have find the 8u201 version from the archives on Oracle.

    Reply
      1. Julien Baldini

        Sorry but just to be sure I understood
        We have to update both, Serviio and Java ?
        Thanks again for your work !

      2. patters Post author

        You don’t have to update Java, but you probably should since each release fixes security vulnerabilities.

  29. Cor Orama

    How can I downgrade to 1.9.2? Subtitles in srt donā€™t work anymore. Seems to be an issue with the profiles. Generic in 1.9.2 is broader than in 1.20.

    Reply
    1. patters Post author

      Manual install of 1.9.2 from here. You will probably have to re-create your database.
      If it’s a generic issue though (i.e. the same fault persists if you test install on another computer rather than a NAS), then I suggest also reporting it on the Serviio forums.

      Reply
  30. Nicolai

    Hey there,

    Running Serviio with Java8 from Synology, can’t get Serviio to work with Patters java package, Serviio stops immediatly after trying to run.

    So with Java8 it starts and I’ve configured folders in my library, just basically added /volume1/video. Now the issue is that the library doesn’t find any videos of any kind. No errors or anything, just a library that doesn’t update.

    Can you help me, I’m kinda desperate :/

    Thanks.

    Reply
  31. Echable

    On my DS415PLAY, having Serviio turned on in package center causes constant disk usage and high Java memory usage (145MB private memory Java process, one of these “running” in Synology Resource Monitor, as many as over 30 Java processes with same memory consumption but “sleeping”). Memory usage constantly at 65% even with nothing active running, just the packages on (1GB RAM total on my NAS model DS415PLAY).

    Is this some kind of bug ? Anything I can do about it in Serviio settings ? Library is fully scanned, is it perhaps the “auto-watch for new files” setting in Serviio causing this ?

    I am using DS415PLAY, the Java package recommended from the Pcloadletter repository, with the strongest JCE Oracle encryption option, and the Evansport hardware transcoding option selected during install.

    Thank you very much for any help :)

    Reply
  32. Echable

    BTW just to confirm: turning Serviio off in package center causes all the 30+ Java processes to disappear from Resource monitor processses and memory usage to drop to 35%ish and disk usage to stop.

    Reply
  33. Selo

    noob questions : Does serviio 2.0 works with DiskStation DS218j , are the profiles the same as the windows app so i can import my current profile to the nas app ? will i be able to transcode only the audio for h264 files and leave the video untouched.

    Reply
    1. patters Post author

      Hi, I have a recollection that the Java for those ARMv7 CPUs became very unstable with DSM after version 6 I think, so you may find that the Serviio server doesn’t stay running for long. However I plan to make a newer Java package for the much newer versions like v12 or v13. I have this working on my own Intel based NAS. The profiles are The same yes, but you need to use SSH access to copy them to the correct folder since the NAS doesn’t expose /var/packages/ via the DSM GUI. Yes you could transcode audio only with the right destination device and profile.

      Reply
  34. guzuguzulv

    Dears,
    Let me first thank you for creating and keeping this project alive. I am still using free version, as I have troubles understanding the extra benefits of getting a license. I do not have stacked videos like DVD’s or bluray. Could anyone explain why should I go with paid version, which frankly speaking I do not mind.

    By the way, I get constantly a message that a new 2.1 version is available for my DS718+, but nothing is there, on the web-site. More then that, Servio does not update list of files and folders since then. I have to give a force update once in a while. Thanks.

    Reply
  35. frank479

    To update for the Synology NAS, I tried uninstalling and then reinstalling. But, the wizard says the newest online version is the one I just uninstalled, 2.0.0-0037, not version 2.1 like I was expecting. How do I go about getting the latest version 2.1? There’s no link to download the Synology version like the other platforms.

    Reply
  36. Lylmik

    First of all, thanks for doing this. I have DS620slim running Serviio 2.0 with Synology version of Java package with no major issues. The only thing I have noticed is that it does not do transcoding of video. Since I did try the Synology Media Server app first, I noticed that with current version it is using ffmpeg 3.3, The storage has Intel Celeron J3355 cpu, that should be capable of some transcoding and so far when watching any video the cpu load stays below 10% on the storage no matter what I do. So how would I go about enabling transcoding on Serviio or would I need to wait for a newer version of Serviio to be ported to Synology before I can tackle that?

    Reply
  37. Dave

    Hi,
    Thanks for all you work!
    Are there any plans to update to 2.1, or are there technical difficulties in doing so?

    Thanks

    Reply
    1. patters Post author

      Hi – the challenge is time these days. I am planning to do this soon. I’ve just unpicked how the repository works and I should be able to update Serviio soon.

      Reply

Leave a reply to Iulian Cancel reply