Matroska .mkv files in Synology’s DS Video app

Playing Matroska files via Synology’s DS Video app on iOS.

Matroska, recognizable by the .mkv extension, is a media container format. It can hold video, audio, pictures, and subtitles in a single file. Think of it as a ZIP archive for videos.

For a while now I am trying to figure out why some .mkv files can’t be played on the iOS DS Video app, a companion video player for the Synology NAS. I always thought the Synology DS Video iOS app had trouble reading the video format. Some played in the Synology web app but not on iOS, some played in the DS File app but not the DS Video one, etc, etc.

MP4 Always Works

Comparing a working with a non-working Matroska file showed both contained MP4 video files so I gave up trying to understand the world of video codecs and blamed the weird Synology iOS app. Converting the Matroska files to MP4 fixed the issue. Converting a video from one format to another takes time though and loses a bit of quality each time. Annoying.

Finding the Culprit: Audio

Fast forward a few months and another .mkv file that can’t be played. Taking a closer look showed no difference between the video files but the audio had different encodings! The working one had an AC-3 audio track, the non-working an E-AC-3 one. Enhanced AC-3 is the newer audio format, AC-3 the older one. I removed the audio track from the Matroska container and… the DS Video app happily played the video. Progress!

Now that I learned the DS Video iOS app has problems playing Digital Dolby Plus audio (another name for E-AC-3) I no longer need to convert the whole MKV to MP3: simply re-encoding the audio track is way faster!

FFmpeg to the Rescue

First, I make sure the audio is indeed E-AC-3 using ffprobe, an FFmpeg compagnion program. Next, I convert the E-AC-3 audio track to AC-3 via a command I found on the VideoHelp Forum.

  $ ffprobe -v error -show_format -show_streams input.mkv
  $ ffmpeg -y -i input.mkv -c:a ac3 -b:a 640k output.mkv
  

This only takes a minute or so, compared to half an hour for a full re-encoding of the video file. Win!

Subtitles

Now that I finally understand the issue it might be time to look at different iOS video player. Not only is the DS Video app picky with video and audio formats, it also has this weird subtitle issue where it won’t find subtitles if the DS File iOS app is not installed on the same device. ¯\_(ツ)_/¯ I didn’t even know iOS apps could depend on each other.

This post is open source. Did you spot a mistake? Ideas for improvements? Contribute to this post via Github. Thank you!