Custom font style for subtitles
Paul Brown
paul.brown at kde.org
Sun Aug 29 13:20:16 BST 2021
On Saturday, 28 August 2021 22:48:18 CEST vincent wrote:
> Hi Mehdi,
>
> As far as I know, it is not (yet). However, you can use html font tags.
>
> Instead of just typing text, you could do:
> |<font color="red" face="Verdana, Geneva, sans-serif" size="+1">Subtitle
>
> text here</font>|
>
> However, you would have to do that for each subtitle clip, so it would
> be good to either put this in a text editor on the side (so you can copy
> and paste).
OR... srt files are just text files. When you have generated the original
subtitles, look for the .srt file in your project directory. You can process it
automatically with any of the many non-interactive command line text
processors available for Linux.
If you have your subtitles in a file called *subtitles.srt* for example, that
looks like this:
---
1
00:00:02,900 --> 00:00:06,033
I'm a Unix old-timer
2
00:00:06,033 --> 00:00:09,166
I cut my teeth on UNIX 5 and PDPs in the 70s
3
00:00:09,166 --> 00:00:12,166
I wrote programs in ed!
4
00:00:12,166 --> 00:00:14,433
When they said I should try Konsole,
5
00:00:14,433 --> 00:00:16,666
"Pah!" I thought,"Another terminal emulator!"
6
00:00:17,666 --> 00:00:19,600
Boy, was I wrong
[ETC]
---
You could do this from the command line this:
awk '{if ((NR % 4)-3 == 0) {printf "<font color=\"red\" face=\"Verdana,
Geneva, sans-serif\">%s</font>\n", $0} else {print}}' subtitles.srt >
subtitles.special.srt
This will create a new file called *subtitles.special.srt* in which, every
third line (the line containing the subs text) has been re-formatted with HTML
tags. The resulting file looks like this:
---
1
00:00:02,900 --> 00:00:06,033
<font color="red" face="Verdana, Geneva, sans-serif">I'm a Unix old-timer</
font>
2
00:00:06,033 --> 00:00:09,166
<font color="red" face="Verdana, Geneva, sans-serif">I cut my teeth on UNIX 5
and PDPs in the 70s</font>
3
00:00:09,166 --> 00:00:12,166
<font color="red" face="Verdana, Geneva, sans-serif">I wrote programs in ed!</
font>
4
00:00:12,166 --> 00:00:14,433
<font color="red" face="Verdana, Geneva, sans-serif">When they said I should
try Konsole,</font>
5
00:00:14,433 --> 00:00:16,666
<font color="red" face="Verdana, Geneva, sans-serif">"Pah!" I thought,"Another
terminal emulator!"</font>
6
00:00:17,666 --> 00:00:19,600
<font color="red" face="Verdana, Geneva, sans-serif">Boy, was I wrong</font>
[ETC]
---
And renders like what you can see in the attached screenshot.
Importing the file later into Kdenlive so the subtitles can be burned into the
video also works fine, as you can see in the attached Kdenlive screencap.
Cheers
Paul
> > Hi Kdenlive developers and users,
> >
> > I have been enjoying the subtitle editor tool in Kdenlive that I used
> > to miss in old versions a fews years ago. I can add, import, export
> > srt subtitles.
> > However, I don't see a way of customizing font style for subtitles I
> > want to burn to the videos. Is subtitle styling supported in Kdenlive?
> >
> > Best regards,
> > Mehdi
--
Promotion & Communication
www: http://kde.org
Mastodon: https://mastodon.technology/@kde
Facebook: https://www.facebook.com/kde/
Twitter: https://twitter.com/kdecommunity
LinkedIn: https://www.linkedin.com/company/kde
-------------- next part --------------
A non-text attachment was scrubbed...
Name: redsubs.png
Type: image/png
Size: 845177 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdenlive/attachments/20210829/23ce752a/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdenlive_subs.png
Type: image/png
Size: 598674 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdenlive/attachments/20210829/23ce752a/attachment-0003.png>
More information about the kdenlive
mailing list