1

I have an .srt subtitle file. I want to convert it into .ttml format(or xml) using ffmpeg command. I tried using traditional way to convert this. But ffmpeg throwing an error. Is there any way to convert this in Linux platform? Or any other command line applications do this conversion?

Below is the command I tried.

ffmpeg -i my_srt.srt -y srt-to-xml.xml -v verbose

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100
Input #0, srt, from 'my_srt.srt':
Duration: N/A, bitrate: N/A
    Stream #0:0: Subtitle: subrip
Output #0, webm_dash_manifest, to 'srt-to-xml.xml':
Output file #0 does not contain any stream
[AVIOContext @ 0x5614924ef500] Statistics: 22267 bytes read, 0 seeks

I even tried like below.

ffmpeg -i my_srt.srt -y srt_to_ttml.ttml

It didn't work too.

geo-freak
  • 327
  • 3
  • 20
  • *"I even tried like below. `ffmpeg -i my_srt.srt -y srt_to_ttml.ttml` It didn't work too."* Show the complete log from this command. It will tell is why it didn't work. – llogan Oct 12 '21 at 17:38

3 Answers3

1

It looks like ffmpeg 4.4 has minimal support for converting srt into ttml: font styles and positions are not preserved.

ttconv is an alternative.

1

There is a different library that supports conversion to ttml from the command line.

php subtitles.phar input.srt output.ttml
Mantas D
  • 3,993
  • 3
  • 26
  • 26
-1

The FFmpeg TTML muxer uses the .ttml extension:

ffmpeg -i input.srt output.ttml

The TTML encoder and muxer do not have any additional options as of writing this answer (see ffmpeg -h encoder=ttml & ffmpeg -h muxer=ttml).

llogan
  • 121,796
  • 28
  • 232
  • 243