subtitles
The DJ
hartman at mac.com
Mon Jul 1 01:40:18 CEST 2002
on 30-06-2002 17:47, Andrew Flintham at amf at cus.org.uk wrote:
> Firstly, thanks for writing such an excellent program. vlc is superb!
>
> Here's what I'm trying to do:
>
> I like watching Japanese animation, and prefer to buy the original Japanese
> DVDs of things I like, rather than the American versions which tend to be
> somewhat butchered. My Japanese is just about good enough to get the gist of
> things, but it's nice to have English subtitles to help pick up new
> vocabulary.
> Obviously, Japanese DVDs don't have English subtitles; most don't even have
> Japanese ones. However, it is possible to download "scripts" for popular
> shows from the net (e.g. http://gsoft.smu.edu/ScriptCrypt/crypt.html), leaving
> just the problem of playing them along with the DVD.
>
> Software to do this already exists for Windows (e.g.
> http://www.dvdsubber.com),
> but I use Linux, and there doesn't seem to be anything similar. So I thought
> I'd see if I could modify vlc to do this for me, so I could use my favourite
> DVD player to watch my favourite DVDs :)
>
> I've thus written a "subtitler" module for vlc, which takes a timed subtitle
> script, and in theory, displays the right text at the right time. It renders
> the text as a subpicture using a run-length encoded proportional font; you
> can see an example screenshot at http://cus.org.uk/~amf/subtitler.jpg
> although it's difficult to convey the impression of changing text in a single
> still frame.
>
> (annoyingly, just as I was about to send this email, I noticed someone else
> may also be working on subtitle support. Hope I'm not treading on anybody's
> toes with this, therefore)
Wow, great job. That person would probably be me. Don't worry, I was just
looking into it. Setting up some design stuff etc. I'm actually still
working on one of my own programs at the moment and I've been moving for the
past couple ideas.
> However, I've come across a couple of problems, and I was wondering if you
> had any suggestions as to where I might be going wrong. I've been using vlc
> version 0.4.1 if that makes any difference.
>
> a) how should I start the "subtitler" module?
>
> When I started writing the subtitler, I thought the best place to begin would
> be to take the existing "spudec" module, as it already used subpictures to
> overlay subtitles on screen (albeit from the DVD, not from text). So my
> "subtitler" module is essentially a decoder module, which waits for a DVD_SPU
> elementary stream to start itself off. Once started, it ignores any data on
> that ES, and uses its own loop to display the subtitles.
Altough in essence this is a good approach, I think it is not good to limit
this to DVD. It would be far better if we could do this for an arbitrary
file. I've been thinking about this issue aswell, and I think the best
approach may be to just expand the entire structure, because not much
outside vlc is depending on this now. With the upcoming libvlc this might
become different, so this actually might be the last change to change this.
I'm thinking about a system where you could add arbitrary arguments to any
of the inputs. I don't know how this works at the moment, I haven't taken a
look at it yet.
> This worked ok for the test DVD I was using, but then I found that because
> most Japanese DVDs have no subtitle tracks at all, there isn't a DVD_SPU ES
> to start the subtitler. To get round this, I faked a DVD_SPU ES in
> plugins/dvd/dvd_es.c:DVDLaunchDecoders, by creating a new ES and feeding a
> null packet to it. This was enough to start my subtitler.
>
> I don't like this approach; it feels like an inelegant hack, but I wasn't
> sure where my "subtitler" module should fit in vlc's architecture. It isn't
> really a video output module, nor is it really a decoder module, and I don't
> know where else to put it.
I don't think there is a real place for this addon. One approach might be to
introduce a On Screen Display. But I think that for the moment your current
approach is the best we are going to get.
> b) how should I get the "current time" of the DVD?
>
> I've been using a similar method as input_OffsetToTime does, working on the
> basis that "i_seconds = i_offset / 50 / p_input->stream.i_mux_rate", but this
> doesn't give me the right times. This can be easily demonstrated by playing a
> DVD and comparing elapsed time according to vlc with elapsed time according to
> a stopwatch, or comparing times at which chapters start against a physical DVD
> player.
>
> For instance, chapter 38 of "The Matrix" (region 2, widescreen) starts at
> 2:03:22 according to my physical DVD player (an LG DVD-3200E), but at 1:43:15
> according to vlc. Sadly, the ratio between the two isn't constant for
> different DVDs, or even DVDs of a similar type, for instance:
<cut>
> In all cases, p_input->stream.i_mux_rate was 16800. I can change this by
> hand to get individual DVDs to work ok, but that's far from ideal.
>
> Any suggestions you could give me on this would be most appreciated. If I can
> get this working properly, you're welcome to the code if it's of any interest.
No clue. Someone with more core-knowledge care to elaborate?
The more I think about all this, the more I look at sourcecode, the more I
get the feeling that if we want to do this the nice way, we will have to
make some changes to the core of vlc and that a plugin alone will not cut
it.
I would love to see your code, can you post a diff somewhere?
DJ
---------------------------------------------------------------------------
Universiteit Twente
---------------------------------------------------------------------------
Derk-Jan 'The DJ' Hartman
ICQnr: 10111559
Mail: mailto:hartman at mac.com
WWW: http://home.student.utwente.nl/d.hartman/
Goto: http://xamba.sourceforge.net
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel
mailing list