[MPlayer-dev-eng] More subtitles: mencoder with DVD subtitles, mplayer with Fri Jan 4 01:50:38 2002

Kim Minh Kaplan kmkaplan at selfoffice.com
Fri Jan 4 02:11:00 CET 2002


Arpi writes:

>> Support for subtitles in mencoder.  Currently only works correctly if
>> no image resizing is applied.  If you upscale the image, the subtitles
>> will be to small and too much toward the upper left corner (they are
>> not scaled).  Downscaling is a complete NO NO!  Fix will be soon.
>
> Please wait with this.
> We need a big change in mencoder: first assemble the image slices together
> to a whole image. When the frame decoding is done, and we have the complete
> image, we should do some optional filtering:
> - render subtitles
> - crop/expand
> - colorspace conversion (to yv12, requires for scaling)
> - scaling
> - colorspace conversion (to encoder's accepted format)
>
> this way subtitles will be scaled.

That's exactly what the patch does: render subtitles after the image
has been decoded.  But the scaling takes place as the image is decoded
so it takes place before.  Regarding scaling, I had to implement it
for VobSub, so it was my next planned move because it is now easy.
I'll put it on hold until you say start...

>> Preliminary support for VobSub subtitles.  Use the -vobsub option.
> few questions:
> - why is it in mplayer only?

I had no time to include it in mencoder & test it.  And furthemore it
is not as much needed in the encoder (I believe it is better to have the
subtitles in a separate file).

> - why is palette NULL? the included vobsub code requires IFO file as well.

This was introduced because some patch decided to call spudec_new
regardles of the user's choice of displaying subtitle.  So I had to
take care of this.  The original code from mplayer.c looked like:

    if (dvdsub_id >= 0) vo_spudec=spudec_new(stream->priv);

but now as I only take the palette as input, I have to copy it, and
check for the NULL case.

> - why you need external mpg demuxer code (vobsub.c) ? isn't libmpdemux ok?
>   (not a big prob, i just want to minimalize redundant code)

I wanted to use libmpdemux, but could not make it work with a stream
that does not contain audio & video (see some of my previous questions
to the list).  I feared that hacking demux_mpg.c would introduce bugs
about everywhere so I went the redudant way.  But I would also prefer
to use the same code...  I just can't see how.

> - why did you add new render entry to libvo's sub.c ? i think as dvd sub and
>   vobsub are very similar things, they should be handled by the same code.

So that you can display two subtitles at once: the ones from your DVD
and the one from your VobSub file...  Very useful isn't it ;-) More
seriously, Vobsub subtitles have to be scaled.  So they are handled a
bit differntly.

>> Opacity is not yet correct with antialiasing.

I think I corrected that one now.

>> Seeking backward is not possible.  When seeking forward or when
>> selecting a subtitle that is not the first in the file, subtitles
>> take a very long time to catchup.
>
> maybe we should go through the vob, and read all subtitles to memory.
> then we could freely seek. i don't think it needs too much memory. if yes,
> we can only keep the indices of file, and read it runtime.

Mmm, possible.  It would also help when subtitle are on the same cdrom
as the movie: with my system, reading from two files at the same time
caused wreackage in the streaming of the movie.  Copying the subtitles
on my hard drive solved it.  Now the VobSub file I have is around 5M.
Is that ok?

Kim Minh.



More information about the MPlayer-dev-eng mailing list