Can't change fontColor for STL file
AntoineTohan opened this issue · comments
Hello,
I am trying to change the color of the caption text for STL subtitle file but I can't.
Here is my use case:
- I read a SRT file
s, _ := astisub.OpenFile(input)
- I add the GSI to my subtitle (
s.Metadata
) object :
s.Metadata = &astisub.Metadata{
Title: fileNameWithoutExtTrimSuffix(input),
Comments: comments,
STLDisplayStandardCode: "1",
STLCharacterCodeTableNumber: 12336,
STLCodePageNumber: 3683891,
Framerate: 25,
Language: "french",
STLCountryOfOrigin: "FRA",
STLCreationDate: ¤tTime,
STLRevisionDate: ¤tTime,
STLMaximumNumberOfDisplayableCharactersInAnyTextRow: astikit.IntPtr(40),
STLMaximumNumberOfDisplayableRows: astikit.IntPtr(7),
STLPublisher: "",
STLSubtitleListReferenceCode: "",
STLOriginalEpisodeTitle: "",
STLTimecodeStartOfProgramme: tcp.PresentationTime()
}
- I add the TTI metadata to my subtitle object :
for idx, item := range s.Items {
styleJustification := styles.Styles[idx].Justification
styleVerticalPosition := styles.Styles[idx].VerticalPosition
styleColor := styles.Styles[idx].Color
c, _ := ParseHexColor(styleColor)
justification := convertJustification(styleJustification)
position := astisub.STLPosition{
MaxRows: 7,
Rows: 7,
VerticalPosition: styleVerticalPosition,
}
color := astisub.Color{Red: c.Red, Green: c.Green, Blue: c.Blue}
attr := astisub.StyleAttributes{
STLJustification: &justification,
STLPosition: &position,
TeletextColor: &color,
TTMLColor: astikit.StrPtr(color.TTMLString()),
}
item.InlineStyle = &attr
}
- Finally I create the STL subtitle file with
s.Write(output)
My problem: All of the GSI and TTI metadatas works fine EXCEPT for the text color which is not in my final STL file. However I did change the TeletextColor
and TTMLColor
.
Can you help me to make the text color work for STL file ?
You can't update text color in STL files with this library.
In your astisub.StyleAttributes
struct, using attributes that are not prefixed with STL
doesn't have any impact in the process.
I guess the only way to color text in STL files would be to indicate color in teletext encoding, but that library doesn't handle it.
Ok, thank you for your answer !