Synology and the DTS issue

Today I noticed, that certain video files from my Synology would not play in the browser. I quickly found out, it’s an issue with DTS Audio Tracks, which appearently has been arround for ages. The Synology is not new, but I never noticed until now, because I mostly just played videos over NFS. But the Video Station also gives you the ability to play them over the browser, which is nice to have if you are not at home and want to play videos over a remote computer or your phone. So the only solution to get rid of this issue, as it seems, is just converting the files to have another audio format. I made a really simple script to help me with that. I didn’t want to do this manually since I have a lot of video files.

So if anyone has the same issue… a simple loop will do :

will probably need to leave it on over the night 🙂

#!/usr/bin/zsh

# Script for identifying DTS Audiotracks on the NAS
# and convert them to a specific target folder

LOGFILE=${HOME}/dts_scan_files.log
MOVIE_DIR=${HOME}/orilla/media/Movies
TARGET=${HOME}/DTS_CONVERTER_CONVERTED

if [ ! -d ${TARGET} ]; then
    mkdir -p ${TARGET}
fi
if [ ! -d ${MOVIE_DIR} ]; then
    echo "ERROR: could not find directory"
    exit 1
fi
rm -f $LOGFILE
toucn $LOGFILE
echo "SCANNING FOR MEDIAFILES with a DTS AUDIO TRACK"
find ${MOVIE_DIR} -type f | while read file
    do
        filename=$(basename ${file})
        mediainfo ${file} | grep -q  "DTS"
        if [ $? -eq 0 ]; then
            echo "\e[1;31mFOUND DTS FILE:\e[0;33m ${filename}\e[0m"
            echo ${filename} >> ${LOGFILE}
            echo "converting the file and saving it to $TARGET"
            ffmpeg -i ${file} ${TARGET}/${filename}
        else
            echo "\e[0;32mnot a DTS file:\e[0;34m ${filename}\e[0m"
        fi
    done