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 357503 - [suparse] wrong timing with microdvd subtitles
[suparse] wrong timing with microdvd subtitles
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.10
Other Linux
: Normal normal
: 0.10.12
Assigned To: Tim-Philipp Müller
GStreamer Maintainers
: 408012 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-09-24 19:35 UTC by Sven Arvidsson
Modified: 2007-02-17 14:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sven Arvidsson 2006-09-24 19:35:25 UTC
I have some videos with microdvd subtitles. Totem (Gstreamer backend) plays the videos but does not seem to time the subtitles correctly. 

The subtitles have the extension .sub and look like this:

{1}{1}23.976
{2852}{2907}- Hi, Eddie.|- Hiya, Scotty.
{2911}{2994}- Cold enough for you?|- Well, I'm only faintly alive. It's 25 below.

MPlayer plays and times the subtitles correctly.
Comment 1 Sven Arvidsson 2007-01-05 21:01:16 UTC
Solid subtitle support is one of the things still keeping me from playing all my videos with GStreamer, so is there something I can do to debug this further?

If my understanding of microdvd subtitles are correct, they are timed using the framerate of the video. How can I make sure this is being correctly identified?
Comment 2 Tim-Philipp Müller 2007-01-05 23:57:26 UTC
It would be helpful if you could

 - attach an example .sub file

 - give (rough) timings in seconds for the first few subtitles
   of that particular file (mplayer will show the seconds at
   the bottom somewhere).

Haven't actually looked into this, might just be something trivial.

When you say "does not time the subtitles correctly", what do you mean exactly? Is it a constant delay? Or is the delay increasing over time?
Comment 3 Sven Arvidsson 2007-01-07 19:23:34 UTC
Hi,

I think I have parts of it figured out. There is not a delay, but GStreamer display the subtitles too early.

MPlayer displays the second subtitle (see above) at about 119 seconds, Totem at about 78 seconds. It doesn't seem to be any delay between two subtitles, both MPlayer and Totem have the same timings. 

The reason for GStreamer being off seems to be this line:

  state->start_time = (start_frame - 1000) / frames_per_sec * GST_SECOND; 
      
I don't know why 1000 frames are subtracted, but if I remove that, Totem display the subtitles with correct timings. 

As for my inital guess about framerates being calculated wrong, GStreamer is hardcoded to use 23.976 fps:

  const double frames_per_sec = 24000 / 1001.; 
                                 
This means one of my videos (25 fps) still doesn't display with microdvd subtitles correctly, but I guess I will file that as a seperate request.
 
Comment 4 Tim-Philipp Müller 2007-01-07 20:21:33 UTC
I was looking at the code earlier as well, and I have no idea where the -1000 comes from or what it's supposed to be fore. Seems to have been there since the very beginning. Probably a debugging phase leftover.

About the framerate: it should read that from the first line if it is available, and otherwise assume something.

Does the subtitle file that's still off say 25.000 in the first line?
Comment 5 Sven Arvidsson 2007-01-07 20:56:12 UTC
No, it doesn't. But adding it doesn't seem to make any difference either.
Comment 6 Tim-Philipp Müller 2007-01-08 12:32:16 UTC
> No, it doesn't. But adding it doesn't seem to make any difference either.

Not surprising, since the code doesn't look for a framerate in the first line yet :)


I've committed this now:

  2007-01-08  Tim-Philipp Müller  <tim at centricular dot net>

        * gst/subparse/gstsubparse.c: (parse_mdvdsub):
        * gst/subparse/gstsubparse.h:
          Remove spurious 1000 subtrahend when calculating the timestamp from
          the frame number and the frame rate . Also, use the frames/second
          value specified in the first line of the file, if one is specified
          there. Should fix #357503.

        * tests/check/elements/subparse.c: (do_test),
        (test_tmplayer_do_test), (test_microdvd_do_test), (GST_START_TEST),
        (subparse_suite):
          Add some basic unit tests for the microdvd subtitle format.

Please file new bugs if you find any further issues.
Comment 7 Tim-Philipp Müller 2007-02-15 00:01:09 UTC
*** Bug 408012 has been marked as a duplicate of this bug. ***
Comment 8 Kamil Pawlowski 2007-02-15 07:48:48 UTC
I try newest gstreamer-plugins-base-0.10.11 but subtitles still wrong. Did subtitles framerate should be get from movie framerate ? 

Why gstreamer still can't play subtitles? Other players support all type of subtitles.
Comment 9 Tim-Philipp Müller 2007-02-15 09:13:05 UTC
> I try newest gstreamer-plugins-base-0.10.11 but subtitles still wrong.

It's not fixed in 0.10.11, it's only fixed in CVS.


> Did subtitles framerate should be get from movie framerate?

No, that doesn't make sense IMHO. If no frame rate is specified, assuming one is just as good as using a random move framerate, I think. You can specify the framerate in the first line if you like.

Comment 10 Kamil Pawlowski 2007-02-17 14:40:55 UTC
(In reply to comment #9)
> > I try newest gstreamer-plugins-base-0.10.11 but subtitles still wrong.
> 
> It's not fixed in 0.10.11, it's only fixed in CVS.
Yes, CVS version of gstsubparse works :)


> > Did subtitles framerate should be get from movie framerate?
> 
> No, that doesn't make sense IMHO. If no frame rate is specified, assuming one
> is just as good as using a random move framerate, I think. You can specify the
> framerate in the first line if you like.

Did framerate of subtitles is not the same as movie?