bino-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bino-list] SubTitles?


From: Joe
Subject: Re: [Bino-list] SubTitles?
Date: Tue, 15 Mar 2011 12:16:32 +0100
User-agent: KMail/4.6 beta4 (Linux/2.6.37-gentoo; KDE/4.6.1; x86_64; ; )

Hi, 
just one note.

On Tuesday 15 March 2011 11:35:29 Joe wrote:
> On Monday 14 March 2011 22:00:06 Martin Lambers wrote:
> > Hello Joe!
> > 
> > On 14/03/11 04:31, Joe wrote:
> > >> Some subtitle formats are stored in text form, while others are
> > >> stored
> > >> in a fixed bitmap form. I don't know how FFmpeg handles these two,
> > >> but
> > >> bitmaps could be put into a texture and overlayed onto the
> > >> color-corrected video texture, and text could be rendered with an
> > >> OpenGL
> > >> font rendering library. I'd rather not use Qt's built-in text
> > >> rendering
> > >> for this, so that we can make subtitles work also with Equalizer.
> > >> FTGL
> > >> seems to be widely used:
> > >> <http://sourceforge.net/apps/mediawiki/ftgl/index.php?title=Main_P
> > >> age>
> > >> .
> > > 
> > > Thanks for the tip! I used FTGL to implement basic subtitles support
> > > ("--with- ftgl" configure param). Please see the attached patch (it
> > > is
> > > one big patch, but I have finer grained history in my repository).
> > > So
> > > far I've implemented support for srt files and subtitles embedded in
> > > video files in form of plain text (tested on Matroska). Subtitles in
> > > image form will hopefully follow.
> > > 
> > > I draw directly into framebuffer, because I'm not so skilled in
> > > opengl
> > > so I did not managed to put text directly into left/right textures
> > > and
> > > also was unable to set proper color. I think it would be much better
> > > to
> > > have it in textures to be able to set "depth" of subtitles. It would
> > > be
> > > great if you find the time to correct it. (I think FTTextureFont or
> > > FTBufferFont will have to be used). Font rendering starts at line
> > > 905
> > > in video_output.cpp.
> > > 
> > > The patch is just RFC and I plan to clean it into mergeable state so
> > > comment please!
> > 
> > Thank you very much for your work! It's great that you are working on
> > this.
> > 
> > I currently only have one DVD video file that has subtitles, and that
> > does not seem to work yet - it crashes after a while, without actually
> > displaying subtitles. So I did not yet test the rendering code itself.
> > 
> > Do you have links to some freely available video file samples with
> > subtitles, for testing?
> 
> DVD uses image subtitles and they are not implemented yet.
> 
> I think http://samples.mplayerhq.hu is good collection. I'm testing on real
> movies but I found now this example of embedded multiple subtitles in mkv
> and it surprisingly works :-)
> http://samples.mplayerhq.hu/Matroska/subtitles/multiple_sub_sample.mkv
> 
> For testing of srt support, use another example:
> http://samples.mplayerhq.hu/sub/thief.avi and subtitles
> http://samples.mplayerhq.hu/sub/thief.srt . It is working now in latest
> version of my the patch.
> 
> The loading and delivery of subtitle into rendering should work, the problem
> is rendering. On my ATI graphic card it is white and in the middle. On my
> Nvidia card, it catches color from video (hard to see) and are not
> centered. I think it will correct once FTTextureFont will be used.
> 
> > I have some comments based on a first reading of your patch:
> > 
> > - It is ok to make FTGL a mandatory requirement, so you can remove the
> > --with-ftgl option.
> 
> Ok, I realized, that even on my minimalistic system is ftgl installed
> because of some other apps. So it should be an easy dependency (same with
> Pango).
> 
> > - The Debian package of FTGL is libftgl-dev; maybe you can add that hint
> > to the configure script for consistency.
> 
> Not sure what you mean. Configure has some connection to Debian packages?
> :-) I'm not Debian user so maybe you could change that.
> 
> > - From the FFmpeg headers, it seems that SUBTITLE_* should be used to
> > determine the subtitle type, not CODEC_ID_*
> 
> Yes you are right, I have not noticed such defines exists in FFmpeg. Will
> use them.
> 
> > - What character encoding do the FFmpeg subtitle streams use? We may
> > need to do a character set conversion and set an appropriate FTGL
> > charmap, to get non-ASCII languages right.
> 
> FTGL/Pango supports ft_encoding_unicode/unicode. So I would put a combobox
> in configuration dialog with selection of input encoding, than it is
> possible to do the conversion to unicode. Should I use iconv or QT?
> 
> > - From the FTGL overview, it seems that the Texture font type might be a
> > better choice than the Bitmap font type, because it has antialiasing
> > support?
> 
> I'm using Bitmap/Pixmap  because it was the only font I was able to get text
> on screen. Please, help me to get FTGL/Pango render into left/right
> textures with FTTextureFont/buffer with Pango rendered font. I'm not Opengl
> guru as you, so I've tried but always end up with corrupted image.
> 
> > - Is there a way to use font names instead of specifying font files?
> > Then, the default could just be "Sans" to get the default sans serif
> > font of the system. Arial.ttf is problematic because it is not strictly
> > free and thus not available by default on all installations. Maybe we
> > need to use fontconfig to translate a font name to a font file.
> 
> Yes I hate to set font file instead of "logical font name", but it was the
> only way, because QT did not offered me the way to get absolute font path
> from QTfont. Maybe it would require some more low-level X library to get
> that path, but it will break windows versions.
> 
> > - Or maybe we should use something more modern than FTGL; maybe Pango?
> > Then we could use the system's default font choosing mechanism. But we
> > would have to render the subtitle into a memory buffer and then upload
> > that as a texture so that we can render it. Opinions?
> 
> Yes, Pango could be even better replacement of FTGL, because we don't need
> to draw in 3D. I will look at that.

Now I noticed that Pango is GTK based (depends on Glib). I know you want to 
keep QT out from low level parts, but I think it is pretty bad having both QT 
and GTK dependencies. What if I move the font rendering part to 
video_output_qt.cpp and video_output.cpp will work only with prepared image 
buffers? This way we would avoid the need of iconv and FTGL/pango dependencies. 

> 
> > - Some minor style inconsistencies: please use spaces instead of tabs,
> > and avoid spaces at line ends. Also, there are some places where spaces
> > are missing spaces after if/for/...
> 
> Did noticed the spaces. I'm not used to them but will follow.
> 
> > It would great to merge your work. How should we proceed? Would you like
> > to post updated versions of the patch, or should we set up a 'subtitles'
> > branch in the Bino repository that we can later merge into the master
> > branch?
> 
> I've set up repository on GitHub:
> https://github.com/cuchac/bino
> 
> I will do all the development there and you can pull from it when you think
> it is ready/usable enough. Few minuted ago I pushed one little fix to be
> able to play Thief.avi example for srt testing.
> 
> > Best regards,
> > Martin
> 
> Joe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]