MKV Embedded Subtitles

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
pen
Posts: 60
Joined: Mon Sep 02, 2013 11:47 pm

MKV Embedded Subtitles

Post by pen »

Hi.

My problem is that I cannot play MKV files with embedded subtitles on my Samsung TV (model D). It seems to be confirmed that Samsung cannot render natively embedded subtitles so transcoding is needed. Chosing the #TRANSCODE folder results in a two phase ffmpeg command suite for first extracting to .ass with an error and empty file as result and then transcoding with "-vf ass" as filter option where ffmpeg exits with "error opening filter". It turns out that my ffmpeg was compiled without --enable-libass which seems to be the missing part according to sources on the web.

If I instead use the ffmpeg boundled with UMS, the MKV subtitles transcoding works as it should. So obviously the problem is within my ffmpeg. The reason that I cannot use the ffmpeg boundled with UMS is that it is not compatible with HLS/HTTPS web-streaming which I need for some web-content (SVTPlay) to work. And as of my understanding, no one is prepared to maintain the boundled version so that's why I'm not requesting the feature to be added.

Now before I start the huge work to get a working ffmpeg, I'd like to get some confirmation that my conclusion is correct. Or else if someone could point out the correct building options.

If I get a confirmation that I am on the right track, then I will first try to get the missing lib into Jon Severinssons ffmpeg build for Ubuntu (which works like a charm apart from MKV embedded subtitles).

The complete list of libs (build options) in the boundled ffmpeg that are not in my ffmpeg is:
lxml2, lexpt, libmp3lame, gray (?), libass, libvo-cenc, libvo-amrwbenc, version3 (?).
The list comparing in the other direction is even longer.

Pen

PS: I also see that the target .ass file and the source .ass file path are not the same (the target ending up in /tmp and the source fetched from /var). So this might be a further problem which looks like a bug or setting issue in UMS or it might just be that UMS tries the paths in order. Any help with this is also appreciated. At worse I can make a symbolic link as a workaround.

Debug log

Code: Select all

DEBUG 2014-03-08 17:07:00.605 [New I/O worker #3] Starting transcode/remux of 12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ.mkv with media info: container: matroska, bitrate: 1994752, size: 1960063671, video codec: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), duration: 02:14:05.87, width: 720, height: 304, frame rate: 23.98, thumb size : 9579, muxing mode: null, mime type: video/x-matroska
	Audio track id: 0, lang: und, flavor: null, audio codec: AC3, sample frequency:48000, number of channels: 2, bits per sample: 16
	Subtitle track id: 0, type: ASS, flavor: null, lang: swe, externalFileCharacterSet: null
DEBUG 2014-03-08 17:07:00.609 [ffmpeg-191] Starting /usr/bin/ffmpeg -y -loglevel fatal -i /mnt/Paros/Filmer/1/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID-WhiteFlameZ/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ.mkv -map 0:s:0 /tmp/universalmediaserver/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ.ass
DEBUG 2014-03-08 17:07:00.638 [ffmpeg-191] Attaching thread: ffmpeg-191
DEBUG 2014-03-08 17:07:00.639 [ffmpeg-191] Unix process ID (/usr/bin/ffmpeg): 11417
INFO  2014-03-08 17:07:00.641 [ffmpeg-191] Process /usr/bin/ffmpeg has a return code of 1! Maybe an error occurred... check the log file
DEBUG 2014-03-08 17:07:00.642 [New I/O worker #3] No encoding detected for /tmp/universalmediaserver/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ.ass.
DEBUG 2014-03-08 17:07:00.644 [New I/O worker #3] No encoding detected for /tmp/universalmediaserver/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ.ass.
DEBUG 2014-03-08 17:07:00.644 [New I/O worker #3] No encoding detected for /var/local/UMS/data/subs/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ_ID0_1391968285000.ass.
DEBUG 2014-03-08 17:07:00.645 [ffmpeg-192] Starting /usr/bin/ffmpeg -y -loglevel fatal -i /mnt/Paros/Filmer/1/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID-WhiteFlameZ/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ.mkv -vf ass=/var/local/UMS/data/subs/12.Years.a.Slave.2013.SWESUB.DVDScr.XVID.WhiteFlameZ_ID0_1391968285000.ass -bufsize 12500000 -maxrate 11000000 -crf 16 -c:a copy -c:v libx264 -preset superfast -level 31 -pix_fmt yuv420p -f mpegts pipe:
DEBUG 2014-03-08 17:07:00.676 [Thread-782] Error opening filters!
DEBUG 2014-03-08 17:07:00.689 [ffmpeg-192] Attaching thread: ffmpeg-192
DEBUG 2014-03-08 17:07:00.690 [ffmpeg-192] Unix process ID (/usr/bin/ffmpeg): 11423
INFO  2014-03-08 17:07:00.690 [ffmpeg-192] Process /usr/bin/ffmpeg has a return code of 1! Maybe an error occurred... check the log file
Comparision of of ffmpeg

Code: Select all



UMS boundled ffmpeg (can transcode mkv embedded subtitles)

admin@Athena:~$ /usr/local/bin/UMS/linux/ffmpeg
ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 27 2013 05:14:45 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/32bit --arch=x86_32 --extra-cflags='-m32 -I/root/ffmpeg-static/32bit/include -static' --extra-ldflags='-m32 -L/root/ffmpeg-static/32bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 55.100 / 52. 55.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.101 / 55.  5.101
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...


Jon Severinssons ffmpeg (can not transcode mkv embedded subtitles)

admin@Athena:~$ ffmpeg
ffmpeg version 0.10.11-7:0.10.11-1~precise1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb  6 2014 16:53:05 with gcc 4.6.3
  configuration: --arch=amd64 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.11-1~precise1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...


Server Ubuntu 12.04, Renderer Samsung 46D6300
Vallimar
Posts: 36
Joined: Fri Oct 04, 2013 1:15 pm

Re: MKV Embedded Subtitles

Post by Vallimar »

ffmpeg version 0.10.11-7:0.10.11-1~precise1
That is a really old version and it does not support subtitles.
pen
Posts: 60
Joined: Mon Sep 02, 2013 11:47 pm

Re: MKV Embedded Subtitles

Post by pen »

So which libs should I include? None of the versions works for all use cases!

I think the best answer would come from someone knowing the build options used for the Windows ffmpeg version since 99.9 % of all UMS users seems to use Windows, so I think I should have least problem if I was as close as possible to that ffmpeg.
Server Ubuntu 12.04, Renderer Samsung 46D6300
Vallimar
Posts: 36
Joined: Fri Oct 04, 2013 1:15 pm

Re: MKV Embedded Subtitles

Post by Vallimar »

For subtitles, you need a recent version of FFmpeg that has support for libass, that is the library for handling the subtitles. You'll also need freetype. As far as HLS/HTTPS--the https portion will require gnutls or openssl. I'm not sure if HLS needs anything else as I'm not familiar with it.
User avatar
SubJunk
Lead Developer
Posts: 3707
Joined: Sun May 27, 2012 4:12 pm

Re: MKV Embedded Subtitles

Post by SubJunk »

Did you ever manage to build a version of FFmpeg that would work for you?
pen
Posts: 60
Joined: Mon Sep 02, 2013 11:47 pm

Re: MKV Embedded Subtitles

Post by pen »

SubJunk wrote:Did you ever manage to build a version of FFmpeg that would work for you?
Yes, finally I did. With some help in another thread. It works like a charm for my use cases. Other build options might apply for other use cases.

Trying to understand the options used for Windows (which always works) I had to post in the general track:

viewtopic.php?f=9&t=1683

Thank's again to those who helped me.

Pen
Server Ubuntu 12.04, Renderer Samsung 46D6300
Post Reply