Page 1 of 1

[SOLVED] Serviio v1.2 burned subtitles

PostPosted: Sun Mar 03, 2013 6:28 pm
by mr.gilbo
Firstly I'd just like to offer my thanks to both the Serviio developers and community members that have put in so much hard work in getting both burned-in subtitles and Sony Bravia widescreen aspect ratio fixes built into the latest version of Serviio. For the first time last night I watched a foreign film in true widescreen with perfectly rendered SRT subtitles on my 2010 model Bravia TV.

I do have just one question regarding libASS and burned in subs, though. It is possible in any way to manually specify either the font or the vertical position of the subtitles? The size is pretty much bang on but it would be nice if I could have them rendered an inch or so up instead of being right at the very bottom of the picture.

Keep up the great work chaps.

Re: Serviio v1.2 burned subtitles

PostPosted: Sun Mar 03, 2013 7:19 pm
by Illico
mr.gilbo wrote:It is possible in any way to manually specify either the font or the vertical position of the subtitles? The size is pretty much bang on but it would be nice if I could have them rendered an inch or so up instead of being right at the very bottom of the picture.

With Serviio 1.2, the only solution to change parameters of subtitles (position, font size, color, aspect,etc) is to use external ass subtitle file and edit some parameters:
see this example: viewtopic.php?f=5&t=9466#p64510
You don't have access to font parameters for other external subtitle files format or embedded ones.

Re: Serviio v1.2 burned subtitles

PostPosted: Sun Mar 03, 2013 9:12 pm
by zip
Fonts are picked by fontconfig library in FFmpeg. There are some config files under the config folder with fonts mapping, so you could update those to render a different (default) fonts, for example.

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 8:30 am
by Illico
zip wrote:Fonts are picked by fontconfig library in FFmpeg. There are some config files under the config folder with fonts mapping, so you could update those to render a different (default) fonts, for example.

Zip, are you talking about xml conf file
C:\Program Files\Serviio\config\fonts\fonts.conf
or
C:\Program Files\Serviio\config\fonts\fonts.dtd

It's a new concept for many serviio users, do you know some "howto","wiki" links about fontconfig library configuration ?

EDIT: Found these ones:
http://en.wikipedia.org/wiki/Fontconfig
http://www.freedesktop.org/software/fon ... -user.html
http://www.freedesktop.org/software/fon ... l/x19.html

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 10:49 am
by mr.gilbo
Illico wrote:With Serviio 1.2, the only solution to change parameters of subtitles (position, font size, color, aspect,etc) is to use external ass subtitle file and edit some parameters.


I think there might be some issues with ASS subtitles. The video files I have with SRT play perfectly so I tried converting the subtitles to ASS using ffmpeg. The resulting ASS subtitles play perfectly with VLC and I am able to adjust the styles as you suggested.

However, Serviio now will not play these files either in the Media Browser (300: Player Initialization Error. Unrecognised file format) and on my TV I receive "Temporarily Cannot Access The Server". The Serviio logs complain of an error "500, ffmpeg execution failed".

I've tried testing my build of ffmpeg by itself using the following flags:

  Code:
-vf subtitles=file.srt
-vf ass=file.ass

If I specifically format the option to use either subtitles= or ass= depending on the type of subtitle I'm trying to use then encoding proceeds as normal. At first I just tried using subtitle=file.ass and got an ffmpeg execution failure with a subtitle read error.

Is it possible Serviio is calling ffmpeg using the wrong arguments for .ass files?

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 11:02 am
by zip
those are 2 different filters, ass only supporting ass files, subtitles supporting any sub file (and converting them to ass and subsequentially invoking the same login as the ass filter).

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 11:04 am
by zip
Illico wrote:
zip wrote:Fonts are picked by fontconfig library in FFmpeg. There are some config files under the config folder with fonts mapping, so you could update those to render a different (default) fonts, for example.

Zip, are you talking about xml conf file
C:\Program Files\Serviio\config\fonts\fonts.conf
or
C:\Program Files\Serviio\config\fonts\fonts.dtd

It's a new concept for many serviio users, do you know some "howto","wiki" links about fontconfig library configuration ?

EDIT: Found these ones:
http://en.wikipedia.org/wiki/Fontconfig
http://www.freedesktop.org/software/fon ... -user.html
http://www.freedesktop.org/software/fon ... l/x19.html

No one should be really touching these files, it's just for real hackers. It's the .conf file and files included in the conf.d folder (these are loaded by the main .conf file)

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 11:24 am
by mr.gilbo
I've just turned on detailed logging and can confirm that the ffmpeg syntax for using .ass subtitles seems to be incorrect.

  Code:
2013-03-04 11:02:37,598 DEBUG [ProcessExecutor] Starting /usr/local/bin/ffmpeg -threads 2 -i /home/data/video/test.avi -y -c:v mpeg2video -b:v 17000k -maxrate:v 17000k -bufsize:v 17000k -vf pad=608:342:0:11:black,setdar=4:3,subtitles=filename='/home/data/video/test.ass':original_size=608x320 -r 24000/1001 -g 15 -c:a ac3 -b:a 384k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts /home/pc5dczcbl5yt/Serviio/transcoding-temp-2600-sony2010-ORIGINAL-1e9a72e4e5473dc22b0c9a739e60ed9a.stf


If I replace subtitles=filename with ass=filename, ffmpeg encodes the file correctly and the subtitles look great.

Thanks.

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 1:10 pm
by zip
what is your FFmpeg version. The subtitles filter is there only since 1.1.

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 7:21 pm
by mr.gilbo
I'm using a fresh installation of Serviio v1.2. I have compiled ffmpeg v1.1.1, libRTMP v2.4+ and lame v3.99.5 at the same time using the source code in the downloads section of your website. To get subtitle support I had to install libass / libass-devel v0.10.0 with --enable-libass to enable subtitle support within ffmpeg.

My ffmpeg output is as follows:

  Code:
ffmpeg version 1.1.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar  2 2013 17:08:03 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-libvpx --enable-librtmp --enable-libxvid --enable-static --disable-shared --enable-pthreads --enable-libass --pkg-config=pkg-config --disable-ffplay --disable-ffserver
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100

Please see this reference document for burning in subtitles: http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20burn%20subtitles%20into%20the%20video

There are two different filters that both use libass. "-vf subtitles=" is meant for .srt subtitles but the .ass subtitle filter has to be invoked with "-vf ass=". I am using .ass subtitles as per Illico's suggestion above.

My log output above shows that Serviio v1.2 is using "-vf subtitles=" with .ass files which causes ffmpeg transcoding to abort. I don't know why this causes problems as the subtitle filter is supposed to work with ass files.

Thanks!

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 7:55 pm
by mr.gilbo
zip wrote:those are 2 different filters, ass only supporting ass files, subtitles supporting any sub file (and converting them to ass and subsequentially invoking the same login as the ass filter).


When I test this I don't get the subtitle filter supporting ass files. Trying to use the subtitle filter with .ass files results in ffmpeg abort:

  Code:
# ffmpeg -i test.avi -vf "subtitles=subtitle.ass" out.avi
ffmpeg version 1.1.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar  2 2013 17:08:03 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-libvpx --enable-librtmp --enable-libxvid --enable-static --disable-shared --enable-pthreads --enable-libass --pkg-config=pkg-config --disable-ffplay --disable-ffserver
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[avi @ 0x1974740] non-interleaved AVI
[mpeg4 @ 0x197ac20] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'test.avi':
  Metadata:
    encoder         : FairUse Wizard - http://fairusewizard.com
  Duration: 01:45:43.30, start: 0.000000, bitrate: 1052 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 608x320 [SAR 1:1 DAR 19:10], 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:2: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
[Parsed_subtitles_0 @ 0x1996400] Unable to open subtitle.ass
[AVFilterGraph @ 0x19960e0] Error initializing filter 'subtitles' with args 'subtitle.ass'
Error opening filters!


Using
  Code:
ffmpeg -i test.avi -vf "ass=subtitle.ass" out.avi
produces correct burned in subtitles.

I converted the .srt to .ass using this version of ffmpeg so I'm not sure why the .ass file seems to be incompatible with the subtitles filter. Possibly a bug in ffmpeg?

Re: Serviio v1.2 burned subtitles

PostPosted: Mon Mar 04, 2013 9:18 pm
by zip
I tried it on my Windows Serviio box and it works, try the attached ASS file.

Re: Serviio v1.2 burned subtitles

PostPosted: Tue Mar 05, 2013 12:22 am
by mr.gilbo
Interesting! That subtitle file you uploaded works fine. Comparing it to my test file, yours has an entire [Script Info] section at the start of the file that is missing from mine.

I converted mine from the .srv using the command suggested by Illico in another thread:

  Code:
ffmpeg -i test.srv -y -scodec ass test.ass

Seems odd that ffmpeg creates an .ass file that it can't read back but perhaps something has changed in recent builds. I'll have a go converting some others using different commands / applications but, either way, good to know it works!

Apologies for the false alarm and thanks for your help.

*EDIT*

It looks as though my original test.ass files had 3 extra bytes of random garbage at the start which I'm now unable to reproduce in spite of the fact that I generated those files more than once using the above command.
In any event, it seems the best and most reliable way to convert the subtitle files is simply to use:

  Code:
ffmpeg -i file.srt file.ass