After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625113 - subparse: add support for external SSA/ASS subtitles
subparse: add support for external SSA/ASS subtitles
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 625400 629293 721056 776693 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-07-23 11:05 UTC by Ilya K
Modified: 2018-11-03 11:17 UTC
See Also:
GNOME target: ---
GNOME version: 2.29/2.30


Attachments
The bugged subfile (65.58 KB, text/plain)
2010-07-25 16:23 UTC, Ilya K
Details

Description Ilya K 2010-07-23 11:05:03 UTC
Can't open subtitles in gstreamer (totem mostly) because of this error. There are similar bugs here: https://bugzilla.gnome.org/show_bug.cgi?id=587704 and here: https://bugs.launchpad.net/gst-plugins-base/+bug/402221
Running latest GStreamer and totem on ubuntu maverick
That's the full log of what happens when I run Totem with debug level 2:

(totem:2989): GLib-GObject-WARNING **: value "10752000" of type `guint' is invalid or out of range for property `connection-speed' of type `guint'
0:00:08.900728007  2989  0x8ac5080 WARN              decodebin2 gstdecodebin2.c:1916:type_found:<decodebin21> error: Этот файл является текстовым
0:00:08.900758696  2989  0x8ac5080 WARN              decodebin2 gstdecodebin2.c:1916:type_found:<decodebin21> error: decodebin2 cannot decode plain text files
0:00:08.901170990  2989  0x8ea76e0 WARN                 basesrc gstbasesrc.c:2550:gst_base_src_loop:<source> error: Внутренняя ошибка передачи данных.
0:00:08.901193324  2989  0x8ea76e0 WARN                 basesrc gstbasesrc.c:2550:gst_base_src_loop:<source> error: streaming task paused, reason not-linked (-1)
0:00:08.906839287  2989  0x8ef7a10 WARN                 qtdemux qtdemux_types.c:170:qtdemux_type_get: unknown QuickTime node type iods
0:00:08.906880790  2989  0x8ef7a10 WARN                 qtdemux qtdemux_types.c:170:qtdemux_type_get: unknown QuickTime node type avc1
0:00:08.906894991  2989  0x8ef7a10 WARN                 qtdemux qtdemux_types.c:170:qtdemux_type_get: unknown QuickTime node type avcC
0:00:08.906908383  2989  0x8ef7a10 WARN                 qtdemux qtdemux_types.c:170:qtdemux_type_get: unknown QuickTime node type btrt
0:00:08.906928473  2989  0x8ef7a10 WARN                 qtdemux qtdemux_types.c:170:qtdemux_type_get: unknown QuickTime node type chpl
0:00:08.909919508  2989  0x8ef7a10 WARN                 qtdemux qtdemux.c:5810:qtdemux_parse_trak:<qtdemux1> unknown version 00000000
0:00:08.958753741  2989  0x8ac5080 WARN                   totem bacon-video-widget-gst-0.10.c:2093:bvw_bus_message_cb: Warning message: warning message from element 'decodebin21': GstMessageWarning, gerror=(GError)NULL, debug=(string)"gstdecodebin2.c\(1916\):\ type_found\ \(\):\ /GstPlayBin2:play/GstURIDecodeBin:uridecodebin1/GstDecodeBin2:decodebin21:\012decodebin2\ cannot\ decode\ plain\ text\ files";
0:00:08.981539951  2989  0x8f4f330 WARN                   pulse pulsesink.c:558:gst_pulsering_stream_underflow_cb:<autoaudiosink2-actual-sink-pulse> Got underflow
0:00:08.984938230  2989  0x8f4f330 WARN                   pulse pulsesink.c:558:gst_pulsering_stream_underflow_cb:<autoaudiosink2-actual-sink-pulse> Got underflow
0:00:08.985001837  2989  0x8f4f330 WARN                   pulse pulsesink.c:558:gst_pulsering_stream_underflow_cb:<autoaudiosink2-actual-sink-pulse> Got underflow
0:00:08.985043041  2989  0x8f4f330 WARN                   pulse pulsesink.c:558:gst_pulsering_stream_underflow_cb:<autoaudiosink2-actual-sink-pulse> Got underflow
0:00:08.985081469  2989  0x8f4f330 WARN                   pulse pulsesink.c:558:gst_pulsering_stream_underflow_cb:<autoaudiosink2-actual-sink-pulse> Got underflow
0:00:09.054364084  2989  0x8ac5080 WARN                   totem bacon-video-widget-gst-0.10.c:1604:bvw_handle_element_message: Unhandled element message playbin2-stream-changed from play: element message from element 'play': playbin2-stream-changed, uri=(string)".../video.mp4", suburi=(string)".../video.ass";
(cut off the paths as they're too long)
Comment 1 Sebastian Dröge (slomo) 2010-07-24 13:31:17 UTC
Yes, that's expected. You can't play subtitle files alone. They can only be played when visualizations or video is enabled and a video or audio file is selected.
Comment 2 Ilya K 2010-07-25 11:05:23 UTC
Err, I'm trying to open a video with subtitles. But I only see the video, without subtitles
Comment 3 Sebastian Dröge (slomo) 2010-07-25 16:21:43 UTC
Could you attach the subtitle file you were using to this bug? It was detected as plaintext by GStreamer and not as one of the subtitle formats, which would be a bug in the typefinder.
Comment 4 Ilya K 2010-07-25 16:22:45 UTC
Oh no prob. Attaching it now.
Comment 5 Ilya K 2010-07-25 16:23:30 UTC
Created attachment 166526 [details]
The bugged subfile

Here you have it
Comment 6 Sebastian Dröge (slomo) 2010-07-25 17:14:01 UTC
Ah, this apparently is a SSA/ASS subtitle. We don't support them outside Matroska containers yet, unless you use the assrender element.

Also there's no typefinder for SSA/ASS subtitles yet.
Comment 7 Ilya K 2010-07-25 17:15:09 UTC
Oh, and why not? ASS is great
Comment 8 Sebastian Dröge (slomo) 2010-07-25 17:26:22 UTC
Because nobody implemented it yet and usually you have ASS/SSA subtitles inside a Matroska container (which are supported).
Comment 9 Ilya K 2010-07-25 17:27:44 UTC
Sorry, I'm not good at how Gstreamer works, but if it can render subtitles in MKV, why can't it render subtitles outside it? (at least when they are loaded explicitly)
Comment 10 Sebastian Dröge (slomo) 2010-07-25 17:29:33 UTC
Inside container formats you get the subtitles in chunks with a timestamp when they should be shown. When reading them directly from a file you need to parse everything from the subtitle stream yourself.
Comment 11 Ilya K 2010-07-25 17:30:24 UTC
Oh, I get it now.
Comment 12 Bastien Nocera 2010-07-30 12:36:50 UTC
*** Bug 625400 has been marked as a duplicate of this bug. ***
Comment 13 Tim-Philipp Müller 2010-09-10 15:57:32 UTC
*** Bug 629293 has been marked as a duplicate of this bug. ***
Comment 14 bcxa.sz 2011-08-24 06:33:29 UTC
just one question, does gstreamer developer already have plan to add .ssa/.ass external subtitle support? Or still wait for some volunteer to fix? :)
Comment 15 Sebastian Dröge (slomo) 2011-08-24 06:44:52 UTC
I don't think anybody is actively working on this. It would make sense to add unparsed/non-timestamped ASS/SSA support to subparse *and* assrender btw, the code could be shared between both.
Comment 16 Edward Hervey 2012-06-20 14:16:46 UTC
We should be able to support this by parsing the timestamp in each line and using that as the buffer timestamp.
Comment 17 Tim-Philipp Müller 2012-06-20 14:21:50 UTC
That, and you probably need to split out the header from the text, and put the header in codec_data, or so (I think that's what matroska does). It shouldn't be hard to do, just needs someone who JFDI.
Comment 18 Edward Hervey 2012-06-20 15:23:32 UTC
And it will also need proper typefind support
Comment 19 Tim-Philipp Müller 2012-12-16 12:36:44 UTC
commit 2f177a7616d080937752fe19f15d633fd9e32da3
Author: Tim-Philipp Müller <tim@centricular.net>
Date:   Sun Dec 16 12:05:02 2012 +0000

    typefinding: detect stand-alone SSA/ASS subtitle files
    
    https://bugzilla.gnome.org/show_bug.cgi?id=625113
Comment 20 Arnaud Vrac 2013-02-16 20:02:12 UTC
I have a patch that fixes two bugs in assrender:

 - support for external subtitles, by handling text buffers with no timestamp
 - support for text buffers overlapping in time

There are two commits:
https://github.com/rawoul/gst-plugins-bad/commit/7b8786f9399
https://github.com/rawoul/gst-plugins-bad/commit/29e20f35465

The second one removes all the code to wait for the previous text buffer to expire. This is necessary because multiple buffers might be rendered on screen at the same time. Here are some examples:

http://streams.videolan.org/samples/Matroska/mewmew/mewmew-vorbis-ssa.mkv
http://absolut.zogzog.org/share/samples/ass/overlap.ass

I am not sure my patch is correct though, because the text buffers timestamps are no longer based on the video running time. I'm not sure how to do that since the input text buffer timestamps are fed directly to libass on the text pad. Could this be a problem ?

Thanks
Comment 21 Edward Hervey 2013-08-14 06:07:38 UTC
Arnaud, looks like your patches should go in a separate bug report (they don't fix the issue at hand).

Tim, you assigned this bug to yourself, any updates ?
Comment 22 Tim-Philipp Müller 2013-08-14 10:24:18 UTC
> Tim, you assigned this bug to yourself, any updates ?

Yes, I'm working on it. It's almost finished, if I don't land it this cycle then next.
Comment 23 Arnaud Vrac 2013-08-14 10:43:16 UTC
(In reply to comment #21)
> Arnaud, looks like your patches should go in a separate bug report (they don't
> fix the issue at hand).

I think Tim mentioned on IRC that his patches will be a more generic version of mine, which only work with libass.
Comment 24 Tim-Philipp Müller 2013-08-14 10:58:18 UTC
The overlapping subtitles thing is a completely separate issue IMHO.
Comment 25 Arnaud Vrac 2013-08-14 11:59:42 UTC
(In reply to comment #24)
> The overlapping subtitles thing is a completely separate issue IMHO.

It is, the patch fixes the overlapping subtitles issue by letting libass handle the buffer queue. But my patch also allows feeding the ASS script directly to libass using ass_process_data when there is no buffer timestamp, which would be required for external ASS file support.
Comment 26 Bastien Nocera 2014-01-07 14:21:09 UTC
*** Bug 721056 has been marked as a duplicate of this bug. ***
Comment 27 Sebastian Dröge (slomo) 2014-09-16 07:57:46 UTC
(In reply to comment #22)
> > Tim, you assigned this bug to yourself, any updates ?
> 
> Yes, I'm working on it. It's almost finished, if I don't land it this cycle
> then next.

Ping? :)
Comment 28 sophie.bonnouvrier_ext 2015-02-19 13:35:36 UTC
Hi

Is a patch to handle external ssa subtitle available ?

Thanks
Comment 29 christophe vr 2016-06-11 12:01:00 UTC
@Tim-Philipp Müller
Hello, I just saw that you're bussy whit the issue ssa/ass codecs.
Yes the ass tag do unfortunately allow the chars such as \N (which they call hard line return) and ... blabla bla .
The main problem is that also handbrake now reencode the imported srt passtrough subs into a ssa/ass with those bloody \N and horrific other signs. It's a nightmare yes but unfortunatelly an allowed "improved ?? codec"

Ok into the plugins-base-subparse the \N for example is set as ' \n' hex 200A .

A least it will not give an error. But the resulting subtitle in a pango page will have :
1) a white space by each line end (before the 0A 20 is set).
2) It will also add an extra blank line. The result in a pango-page is that the final subtitle is one line to high, which is pretty ennoying.

Ok we are working with stb , and so do need our own factory make subtitle-plugin
to be found on :

https://github.com/OpenPLi/gst-plugin-subsink/tree/master

In our application we are using the rendered buffer.

But due to the fact that at each line a white space is added the subtitle centration is not 100 % ok anymore. And the buffer does also still containes a trailing edge \n. I saw the in gstssaparse the lines

gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt)
{
  gchar *t, *end;
  gboolean removed_any = FALSE;

  while ((t = strchr (txt, '{'))) {
    end = strchr (txt, '}');
    if (end == NULL) {
      GST_WARNING_OBJECT (parse, "Missing { for style override code");
      return removed_any;
    }
    /* move terminating NUL character forward as well */
    memmove (t, end + 1, strlen (end + 1) + 1);
    removed_any = TRUE;
  }

  /* these may occur outside of curly brackets. We don't handle the different
   * wrapping modes yet, so just remove these markers from the text for now */
  while ((t = strstr (txt, "\\n"))) {
    t[0] = ' ';
    t[1] = '\n';
  }
  while ((t = strstr (txt, "\\N"))) {
    t[0] = ' ';
    t[1] = '\n';
  }
  while ((t = strstr (txt, "\\h"))) {
    t[0] = ' ';
    t[1] = ' ';
  }

  return removed_any;
}

Is there maybe a change that this can be adpated so that \N  into the sub somewhere is just replaced by \n and the trailing edge \N just removed ?

Since now ok in our application e2 gstreamer player which is in c++ .

We can do (and already did) see patch

https://github.com/OpenPLi/enigma2/commit/a447103455f38760a9ebad84d11bd6b7ae129ce1

But we still will keep the whitespaces 0x20 char by each line. Witch is annoying for text centration.

Ok we could make in c++

for (std::size_t index = line.find(" \n"); index != std::string::npos; index = line.find(" \n"))
{
	if (index + 2 == line.length())
		line.erase(index); // remove white space and newline.
	else
		line.erase(index, 1); // remove whitespace only.
}

That works but , it would be fine if the txt string should be made ok at base ssaparse fase.

When actually the ssa is decoded and recoded as txt string.
Comment 30 Bastien Nocera 2017-01-02 14:12:47 UTC
*** Bug 776693 has been marked as a duplicate of this bug. ***
Comment 31 Edward Hervey 2018-05-30 09:44:39 UTC
(In reply to Tim-Philipp Müller from comment #22)
> > Tim, you assigned this bug to yourself, any updates ?
> 
> Yes, I'm working on it. It's almost finished, if I don't land it this cycle
> then next.

ping :)
Comment 32 GStreamer system administrator 2018-11-03 11:17:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/36.