bino-list
[Top][All Lists]
Advanced

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

Re: [Bino-list] SubTitles?


From: Martin Lambers
Subject: Re: [Bino-list] SubTitles?
Date: Mon, 14 Mar 2011 22:00:06 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8

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_Page>.
> 
> 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?


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.

- The Debian package of FTGL is libftgl-dev; maybe you can add that hint
to the configure script for consistency.

- From the FFmpeg headers, it seems that SUBTITLE_* should be used to
determine the subtitle type, not CODEC_ID_*

- 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.

- 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?

- 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.

- 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?

- 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/...


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?

Best regards,
Martin



reply via email to

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