FAQ  •  Register  •  Login

Subtitles support (burned with ffmpeg libass)

<<

uink

Serviio newbie

Posts: 5

Joined: Mon Dec 03, 2012 1:46 pm

Post Mon Dec 03, 2012 1:59 pm

Subtitles support (burned with ffmpeg libass)

Hi all!

I'm new with all this DLNA stuff, but I already have Serviio running on my Sony Bravia TV and it works pretty well.
The only thing are SUBTITLES....
I know Serviio doesn't yet support subs for Sony TVs, but I don't get why....
The other day I installed PS3 Media Server and it DOES support subs, so why not investigate how it does that and what are the needed plugins/code to make subs work on Serviio???
This feature would make me swap to use Serviio straight away, because I like Serviio much more compared to PS3 Media Server. The only drawback are subtitles... :(

Hope to hear from you soon!

Thanks,

Nuno
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Dec 03, 2012 2:17 pm

Re: Subtitles support

I'm hoping to make the next release after 1.1 all about subtitles.
<<

uink

Serviio newbie

Posts: 5

Joined: Mon Dec 03, 2012 1:46 pm

Post Mon Dec 03, 2012 3:16 pm

Re: Subtitles support

That's great!! Keep up the good work! :)
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Wed Dec 05, 2012 7:45 am

Re: Subtitles support

I make some test with the new "libass" ffmpeg library :
https://bitbucket.org/xnejp03/serviio/i ... upport-ass



Just try the libass and result seems good.

Downloaded Sintel Movie : http://ftp.nluug.nl/pub/graphics/blende ... 0.720p.mkv

Downloaded Srt file : http://durian.blender.org/wp-content/co ... tel_en.srt



With Sintel mkv, you can extract srt and transcode to ass then remux video and sub:

ffmpeg.exe -i Sintel.2010.720p.mkv -y -map 0:5 -scodec ass Sintelfr.ass

ffmpeg.exe -i Sintel.2010.720p.mkv -q:a 0 -q:v 0 -vf "ass=Sintelfr.ass" outfrremux.avi



From an external srt file: sintel_fr.srt (first line in srt should be removed)

ffmpeg.exe -i sintel_fr.srt -y -scodec ass sintel_fr_out.ass

ffmpeg.exe -i Sintel.2010.720p.mkv -q:a 0 -q:v 0 -vf "ass=sintel_fr_out.ass" OUT.avi
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Dec 05, 2012 10:20 am

Re: Subtitles support

@Illico - did you try t on Windows? libass needs some env variables pointing to fontconfig, right? When I tried it it used TimesRoman font, will need some proper fontconfig.xml to render nice fonts.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Wed Dec 05, 2012 12:20 pm

Re: Subtitles support

zip wrote:@Illico - did you try t on Windows? libass needs some env variables pointing to fontconfig, right? When I tried it it used TimesRoman font, will need some proper fontconfig.xml to render nice fonts.

Yes I try with Zeranoe windows build, I created a batch that set environnemnt variable and execute a ffmpeg command line. And I used a fonts.conf from this forum:
http://ffmpeg.zeranoe.com/forum/viewtop ... t=20#p2463
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Dec 05, 2012 2:05 pm

Re: Subtitles support

That's the one I used a well, but the fonts were Times, instead or Arial/Helvetica/SansSerif which is usually used.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Wed Dec 05, 2012 7:54 pm

Re: Subtitles support

zip wrote:That's the one I used a well, but the fonts were Times, instead or Arial/Helvetica/SansSerif which is usually used.


So I used Sintel MKV movie : http://ftp.nluug.nl/pub/graphics/blende ... 0.720p.mkv


In the batch file I set environnement variables:
  Code:
set FC_CONFIG_DIR=C:\temp\Subtitles
set FONTCONFIG_FILE=fonts.xml
set FONTCONFIG_PATH=C:\temp\Subtitles


fonts.xml:
  Code:
<?xml version="1.0"?>
<fontconfig>

<dir>C:\WINDOWS\Fonts</dir>

<match target="pattern">
   <test qual="any" name="family"><string>mono</string></test>
   <edit name="family" mode="assign"><string>monospace</string></edit>
</match>

<match target="pattern">
   <test qual="all" name="family" mode="not_eq"><string>sans-serif</string></test>
   <test qual="all" name="family" mode="not_eq"><string>serif</string></test>
   <test qual="all" name="family" mode="not_eq"><string>monospace</string></test>
   <edit name="family" mode="append_last"><string>sans-serif</string></edit>
</match>

<alias>
   <family>Times</family>
   <prefer><family>Times New Roman</family></prefer>
   <default><family>serif</family></default>
</alias>
<alias>
   <family>Helvetica</family>
   <prefer><family>Arial</family></prefer>
   <default><family>sans</family></default>
</alias>
<alias>
   <family>Courier</family>
   <prefer><family>Courier New</family></prefer>
   <default><family>monospace</family></default>
</alias>
<alias>
   <family>serif</family>
   <prefer><family>Times New Roman</family></prefer>
</alias>
<alias>
   <family>sans</family>
   <prefer><family>Arial</family></prefer>
</alias>
<alias>
   <family>monospace</family>
   <prefer><family>Andale Mono</family></prefer>
</alias>
<match target="pattern">
   <test name="family" mode="eq">
      <string>Courier New</string>
   </test>
   <edit name="family" mode="prepend">
      <string>monospace</string>
   </edit>
</match>
<match target="pattern">
   <test name="family" mode="eq">
      <string>Courier</string>
   </test>
   <edit name="family" mode="prepend">
      <string>monospace</string>
   </edit>
</match>

</fontconfig>




With this one ass file sintel_fr1.ass:
OUT1.png
ffmpeg.exe -i Sintel.2010.720p.mkv -q:a 0 -q:v 0 -vf "ass=sintel_fr1.ass" OUT1.avi
OUT1.png (503.36 KiB) Viewed 34141 times

  Code:
[Script Info]
ScriptType: v4.00+

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,1,1,0,2,10,10,10,0,0

[Events]
Format: Layer, Start, End, Style, Text
Dialogue: 0,0:01:47.25,0:01:50.50,Default,Cette lame a un sombre passé.
Dialogue: 0,0:01:51.80,0:01:55.80,Default,Elle a fait couler bien du sang innocent.
Dialogue: 0,0:01:58.00,0:02:01.45,Default,Tu es bien idiote de voyager seule\Nsans la moindre préparation.
Dialogue: 0,0:02:01.75,0:02:04.80,Default,Tu as de la chance que ton sang coule encore\Ndans tes veines.
Dialogue: 0,0:02:05.25,0:02:06.30,Default,Merci.
Dialogue: 0,0:02:07.50,0:02:09.00,Default,Alors...
Dialogue: 0,0:02:09.40,0:02:13.80,Default,Qu'est-ce qui t'amène\Nsur la terre des gardiens ?
Dialogue: 0,0:02:15.00,0:02:17.50,Default,Je recherche quelqu'un.
Dialogue: 0,0:02:18.00,0:02:22.20,Default,Quelqu'un de très cher ?\NUne âme sœur ?
Dialogue: 0,0:02:23.40,0:02:25.00,Default,Un dragon.
Dialogue: 0,0:02:28.85,0:02:31.75,Default,Une quête dangereuse pour une chasseresse solitaire.
Dialogue: 0,0:02:32.95,0:02:35.87,Default,J'ai été seule\Naussi longtemps que je m'en souvienne.
Dialogue: 0,0:03:27.25,0:03:30.50,Default,C'est bientôt fini. Chut...
Dialogue: 0,0:03:30.75,0:03:33.50,Default,Ne bouge pas !
Dialogue: 0,0:03:48.25,0:03:52.25,Default,Bonne nuit, Scales.
Dialogue: 0,0:04:10.35,0:04:13.85,Default,Attrape-la, Scales ! Vas-y !
Dialogue: 0,0:04:25.25,0:04:28.25,Default,Scales?
Dialogue: 0,0:05:04.00,0:05:07.50,Default,Ouais ! Vas-y !
Dialogue: 0,0:05:38.75,0:05:42.00,Default,Scales !
Dialogue: 0,0:07:25.85,0:07:27.50,Default,J'ai échoué.
Dialogue: 0,0:07:32.80,0:07:36.50,Default,Tu n'as juste pas su ouvrir les yeux...
Dialogue: 0,0:07:37.80,0:07:40.50,Default,Ce sont des terres à dragons, Sintel.
Dialogue: 0,0:07:40.85,0:07:44.00,Default,Tu es plus proche que tu ne le crois.
Dialogue: 0,0:09:17.60,0:09:19.50,Default,Scales!
Dialogue: 0,0:10:21.60,0:10:24.00,Default,Scales?
Dialogue: 0,0:10:26.20,0:10:29.80,Default,Scales...





With this one ass file sintel_fr2.ass:
OUT2.png
ffmpeg.exe -i Sintel.2010.720p.mkv -q:a 0 -q:v 0 -vf "ass=sintel_fr2.ass" OUT2.avi
OUT2.png (489.44 KiB) Viewed 34141 times

  Code:
[Script Info]
ScriptType: v4.00+
Collisions: Normal
PlayResX: 384
PlayResY: 288
Timer: 100.0000

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,18,&H00ffffff,&H0000ffff,&H00000000,&H80000000,-1,0,0,0,100,100,0,0.00,1,2,3,2,20,20,20,1

[Events]
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:01:47.25,0:01:50.50,Default,,0000,0000,0000,,Cette lame a un sombre passé.
Dialogue: 0,0:01:51.80,0:01:55.80,Default,,0000,0000,0000,,Elle a fait couler bien du sang innocent.
Dialogue: 0,0:01:58.00,0:02:01.45,Default,,0000,0000,0000,,Tu es bien idiote de voyager seule\Nsans la moindre préparation.
Dialogue: 0,0:02:01.75,0:02:04.80,Default,,0000,0000,0000,,Tu as de la chance que ton sang coule encore\Ndans tes veines.
Dialogue: 0,0:02:05.25,0:02:06.30,Default,,0000,0000,0000,,Merci.
Dialogue: 0,0:02:07.50,0:02:09.00,Default,,0000,0000,0000,,Alors...
Dialogue: 0,0:02:09.40,0:02:13.80,Default,,0000,0000,0000,,Qu'est-ce qui t'amène\Nsur la terre des gardiens ?
Dialogue: 0,0:02:15.00,0:02:17.50,Default,,0000,0000,0000,,Je recherche quelqu'un.
Dialogue: 0,0:02:18.00,0:02:22.20,Default,,0000,0000,0000,,Quelqu'un de très cher ?\NUne âme sœur ?
Dialogue: 0,0:02:23.40,0:02:25.00,Default,,0000,0000,0000,,Un dragon.
Dialogue: 0,0:02:28.85,0:02:31.75,Default,,0000,0000,0000,,Une quête dangereuse pour une chasseresse solitaire.
Dialogue: 0,0:02:32.95,0:02:35.87,Default,,0000,0000,0000,,J'ai été seule\Naussi longtemps que je m'en souvienne.
Dialogue: 0,0:03:27.25,0:03:30.50,Default,,0000,0000,0000,,C'est bientôt fini. Chut...
Dialogue: 0,0:03:30.75,0:03:33.50,Default,,0000,0000,0000,,Ne bouge pas !
Dialogue: 0,0:03:48.25,0:03:52.25,Default,,0000,0000,0000,,Bonne nuit, Scales.
Dialogue: 0,0:04:10.35,0:04:13.85,Default,,0000,0000,0000,,Attrape-la, Scales ! Vas-y !
Dialogue: 0,0:04:25.25,0:04:28.25,Default,,0000,0000,0000,,Scales?
Dialogue: 0,0:05:04.00,0:05:07.50,Default,,0000,0000,0000,,Ouais ! Vas-y !
Dialogue: 0,0:05:38.75,0:05:42.00,Default,,0000,0000,0000,,Scales !
Dialogue: 0,0:07:25.85,0:07:27.50,Default,,0000,0000,0000,,J'ai échoué.
Dialogue: 0,0:07:32.80,0:07:36.50,Default,,0000,0000,0000,,Tu n'as juste pas su ouvrir les yeux...
Dialogue: 0,0:07:37.80,0:07:40.50,Default,,0000,0000,0000,,Ce sont des terres à dragons, Sintel.
Dialogue: 0,0:07:40.85,0:07:44.00,Default,,0000,0000,0000,,Tu es plus proche que tu ne le crois.
Dialogue: 0,0:09:17.60,0:09:19.50,Default,,0000,0000,0000,,Scales!
Dialogue: 0,0:10:21.60,0:10:24.00,Default,,0000,0000,0000,,Scales?
Dialogue: 0,0:10:26.20,0:10:29.80,Default,,0000,0000,0000,,Scales...



These two examples used default Arial font.

But if I change the style by :
Style: Default,Times,18,&H00ffffff,&H0000ffff,&H00000000,&H80000000,-1,0,0,0,100,100,0,0.00,1,2,3,2,20,20,20,1
OUT3.png
ffmpeg.exe -i Sintel.2010.720p.mkv -q:a 0 -q:v 0 -vf "ass=sintel_fr3.ass" OUT3.avi
OUT3.png (500.62 KiB) Viewed 34139 times
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Sat Dec 08, 2012 11:06 pm

Re: Subtitles support (burned with ffmpeg libass)

The second example looks to be the best and easy to read :geek:
I rarely use subs but im looking forward to using it on my Sony TV!
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

uink

Serviio newbie

Posts: 5

Joined: Mon Dec 03, 2012 1:46 pm

Post Mon Dec 10, 2012 6:20 pm

Re: Subtitles support (burned with ffmpeg libass)

So does this mean we're close to have subtitles on our Sony TVs?
I didn't understand anything of what Illico wrote before, but if someone can point me out to where should I copy the code he provided, I will give it a try, with external srt subtitles. All my movie collection have srt subs...

thanks in advance for your time spent on this subject! :)
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Mon Dec 10, 2012 7:15 pm

Re: Subtitles support (burned with ffmpeg libass)

uink wrote:So does this mean we're close to have subtitles on our Sony TVs?
I didn't understand anything of what Illico wrote before, but if someone can point me out to where should I copy the code he provided, I will give it a try, with external srt subtitles. All my movie collection have srt subs...
thanks in advance for your time spent on this subject! :)


Serviio is based on ffmpeg encoder, and with latest ffmpeg development, its seems that subtitles can be burned on video during encoding.

So Zip (serviio designer), have all bricks to implement this on next serviio version. Now you have to wait.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

uink

Serviio newbie

Posts: 5

Joined: Mon Dec 03, 2012 1:46 pm

Post Tue Dec 11, 2012 1:22 pm

Re: Subtitles support (burned with ffmpeg libass)

That's great news! I'm anxiously waiting for the new version! :)
Let me know if I can help on anything, like beta testing the new version or something like that.
My TV model is Sony Bravia 46HX820.

Thanks for your effort on this subject!
<<

uink

Serviio newbie

Posts: 5

Joined: Mon Dec 03, 2012 1:46 pm

Post Wed Jan 02, 2013 3:06 pm

Re: Subtitles support (burned with ffmpeg libass)

Hi,

just gave a try to the new 1.1 Serviio but no subtitle support on Sony TVs yet...
I think I just have to wait a bit more!
Please, don't give up on this issue! I'm sure many users would be delighted with the ability to use subtitles on their Sony TVs. ;)

Keep up the good Work!
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Jan 02, 2013 3:15 pm

Re: Subtitles support (burned with ffmpeg libass)

Coming in 1.2
<<

Tarugo

Serviio newbie

Posts: 1

Joined: Fri Jan 04, 2013 1:01 pm

Post Fri Jan 04, 2013 3:51 pm

Re: Subtitles support (burned with ffmpeg libass)

Hello, I'm not very advanced user, but why the most DLNA transcoders don't make the out file like mp4?

Look like for me the most commum file for most devices, like iPhone, aTV, Android and my major problem Sony Bravia TV.

For sure, the real problem is the subs, which don't work in any thing I try....

Hopefully the serviio fix this, will be really preciate.

Thanks.
<<

soundcheck

Post Tue Jan 08, 2013 10:37 am

Re: Subtitles support (burned with ffmpeg libass)

Question.

I'd love to try a workaround before Serviio 1.2 is avialable.

Does anybody got a ffmpeg wrapper script working that burns .png (bitmaps) into .m2ts ?? As far as I read that should also work with latest ffmpeg.

How would the command line look like?

THX
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Sun Jan 20, 2013 4:22 pm

Re: Subtitles support (burned with ffmpeg libass)

Looks like even ffmpeg are using libass in their latest 1.1 build - http://ffmpeg.org/

January, 7, 2013, FFmpeg 1.1
- subtitles filter
The subtitles filter makes it possible to merge subtitles supported by libavformat/libavcodec into a video stream. This process is also known as burning them into the video or simply hardsubbing. This filter depends on libass and thus is only available in builds configured with --enable-ass.

- VobSub demuxer
IDX/SUB file pairs can now be played back or be remuxed into other formats such as MKV.
Last edited by Xmantium on Mon Jan 21, 2013 12:25 am, edited 1 time in total.
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

soundcheck

Post Sun Jan 20, 2013 8:52 pm

Re: Subtitles support (burned with ffmpeg libass)

as far as i understood libass is used to convert srt to ass for hardcoding.

here - just saw it -

https://ffmpeg.org/trac/ffmpeg/wiki/How ... he%20video

it is described how to hardcode picture based subs.

i need to try that.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Mon Jan 21, 2013 8:15 am

Re: Subtitles support (burned with ffmpeg libass)

Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

soundcheck

Post Mon Jan 21, 2013 9:21 am

Re: Subtitles support (burned with ffmpeg libass)

I'm looking forward to it.

Hopefully those console apps will allow to turn subs on and off by then.

And not to forget there are quite often several subtitle streams in a container.
That console function should allow for selecting this or that subtitle stream.
(Though priority for me would be to make audio streams selective via console first ;) )


Really nice would be if all audio and sub streams per movie would be made available and selectable via console. Such a setup should be stored in a Serviio database on a per movie basis.
Next

Return to Feature requests

Who is online

Users browsing this forum: No registered users and 12 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.