[FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly

Philip Langdale philipl at overt.org
Fri Jun 12 05:34:46 CEST 2015

On Fri, 12 Jun 2015 00:11:24 +0530
Niklesh Lalwani <niklesh.lalwani at iitb.ac.in> wrote:

> Ok so it goes like this.
> We first find out the height and width of the video stream from the
> header box. The dimensions of the text track (subtitle track) is then
> set (in pixels). Here, we have used the width equal to the width of
> the video, and height equal to 1/10 of the video height.
> The write matrix specifies the coordinate origin and the translation
> values from the origin, ie, where to place the subtitle track. Here,
> we have set tx = 0; and ty = 9/10 of the video track height.
> There is also a text box inside this subtitle area, inside which the
> text is rendered. For now, this is set equal to the the subtitle track
> dimensions.
> Philip, please correct me if I am wrong.

Nicolas was asking about the general mechanism, I think.

So, the subtitle track has dimensions, just like the video track, and
for a given set of dimensions, it can be placed at a position within
the video track's dimensions. In Nikleh's example, it's the same width,
and 1/10 of the height, and placed 9/10'th down, so as to occupy the
bottom 1/10 of the display area.

Within the subtitle area, specific subtitles occupy text boxes that can
be smaller than the full area. In our simple example, all subtitles are
in the same box that occupies the full area.


More information about the ffmpeg-devel mailing list