[FFmpeg-trac] #6947(undetermined:new): Unwanted visual formatting added when embedding subtitles

FFmpeg trac at avcodec.org
Sun Mar 17 13:06:52 EET 2019

#6947: Unwanted visual formatting added when embedding subtitles
             Reporter:  forthrin     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:  mov_text     |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |

Comment (by forthrin):

 @cehoyos: I think this is two issues:

 1. An explicit style being applied when embedding `mov_text` format.
 2. Styles being applied when converting `mov_text` to `srt`.

 For 1), I can't find any documentation for `mov_text` anywhere, but
 looking at `text_sample_entry` in `movtextenc.c`, the binary data seems to
 require explicit values/defaults for font-size, font-style, etc. If so,
 there is no way to prevent some kind of default being present in the file
 as this would corrupt the data layout. If so, it's up to the video player
 whether to favour them over its own font settings. If so, this issue would
 be a non-issue.

 For 2) `<font face="Serif" size="18">` is set because the defaults
 embedded in the `mov_text` data differ from the ASS defaults. See `if
 (st->font_name && strcmp(st->font_name, ASS_DEFAULT_FONT) || st->font_size
 != ASS_DEFAULT_FONT_SIZE || c != ASS_DEFAULT_COLOR)` in `srtenc.c`. The
 patch below resolves this. (Unless the `mov_text` format has some defined
 defaults of its own?)

 diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
 index c19ef384b..f98857c51 100644
 --- a/libavcodec/movtextenc.c
 +++ b/libavcodec/movtextenc.c
 @@ -176,3 +176,3 @@ static av_cold int mov_text_encode_init(AVCodecContext
          0x00,                   // uint8_t face-style-flags
 -        0x12,                   // uint8_t font-size
 +        0x10,                   // uint8_t font-size //
          0xFF, 0xFF, 0xFF, 0xFF, // uint8_t text-color-rgba[4]
 @@ -186,3 +186,3 @@ static av_cold int mov_text_encode_init(AVCodecContext
          0x05,                   // uint8_t font-name-length
 -        'S', 'e', 'r', 'i', 'f',// uint8_t font[font-name-length]
 +        'A', 'r', 'i', 'a', 'l',// uint8_t font[font-name-length] //
          // };

Ticket URL: <https://trac.ffmpeg.org/ticket/6947#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list