GNOME Bugzilla – Bug 625113
subparse: add support for external SSA/ASS subtitles
Last modified: 2018-11-03 11:17:11 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)
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.
Err, I'm trying to open a video with subtitles. But I only see the video, without subtitles
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.
Oh no prob. Attaching it now.
Created attachment 166526 [details] The bugged subfile Here you have it
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.
Oh, and why not? ASS is great
Because nobody implemented it yet and usually you have ASS/SSA subtitles inside a Matroska container (which are supported).
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)
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.
Oh, I get it now.
*** Bug 625400 has been marked as a duplicate of this bug. ***
*** Bug 629293 has been marked as a duplicate of this bug. ***
just one question, does gstreamer developer already have plan to add .ssa/.ass external subtitle support? Or still wait for some volunteer to fix? :)
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.
We should be able to support this by parsing the timestamp in each line and using that as the buffer timestamp.
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.
And it will also need proper typefind support
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
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
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 ?
> 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.
(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.
The overlapping subtitles thing is a completely separate issue IMHO.
(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.
*** Bug 721056 has been marked as a duplicate of this bug. ***
(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? :)
Hi Is a patch to handle external ssa subtitle available ? Thanks
@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.
*** Bug 776693 has been marked as a duplicate of this bug. ***
(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 :)
-- 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.