[FFmpeg-user] Convert srt Subtitle file into ttml subtitle

Pierre-Anthony Lemieux pal at sandflow.com
Wed Oct 6 19:37:42 EEST 2021


On Wed, Oct 6, 2021 at 8:55 AM Christian Ebert <bcc at phloxic.productions> wrote:
>
> * R J on Tuesday, October 05, 2021 at 16:05:16 +0530:
> > I want to convert a .srt file into ttml file.
> >
> > I tried using below command.
> >
> > ffmpeg -i my_srt.srt -y srt-to-ttml.xml -v verbose
>
> How is ffmpeg supposed to know to which format you intend to
> convert?
>
> Either
>
> ffmpeg -i my_srt.srt -f ttml srt-to-ttml.xml
>
> or
>
> ffmpeg -i my_srt.srt srt-to-ttml.ttml

BTW, this results in a TTML file (at least in 4.4) that is missing
positioning information, resulting in the subs being positioned at the
top left of the video. For example,

1
00:00:04,700 --> 00:00:06,736
where are you going so early?

results in:

<?xml version="1.0" encoding="utf-8"?>
<tt
  xmlns="http://www.w3.org/ns/ttml"
  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
  xmlns:tts="http://www.w3.org/ns/ttml#styling"
  xml:lang="">
  <body>
    <div>
      <p
        begin="00:00:04.700"
        end="00:00:06.736">where are you going so early?</p>
    </div>
  </body>
</tt>

which renders to today.png instead of centered text at the bottom at
desired.png, which is typically the expected output.

>
> --
> Szenen aus Georg Büchners Woyzeck
> (1986, schwarz-weiß, 15 Min.)
> https://phloxic.productions/blv/woyzeck
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: today.png
Type: image/png
Size: 110043 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20211006/d443cc5c/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: desired.png
Type: image/png
Size: 181188 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20211006/d443cc5c/attachment-0001.png>


More information about the ffmpeg-user mailing list