Open source command line subtitle converter
Solution 1
You can try FFmpeg (great tool !) :
$ ffmpeg -i file.srt file.vtt
Solution 2
very simple and effective oneliner i use to convert subtitles:
for i in *.ass ; do ffmpeg -i "$i" "$i.srt" ; done
just change ass
and srt
according to your needs.
Solution 3
Subtitles perl swiss army knife (scroll to the end of the page).
Here you can find more options.
Also, mplayer/mencoder has some dumpXXXsub options, which might work. I never tried this, but reading the man, it should work. Example:
-dumpmpsub (MPlayer only)
Convert the given subtitle (specified with the -sub option) to MPlayer's subtitle format, MPsub. Creates a dump.mpsub file in the current directory.
Solution 4
The open source program Subtitle Edit has a command line converter and is available for both Windows and Linux.
Syntax:
SubtitleEdit /convert "pattern" "name-of-format-without-spaces"
Example 1:
SubtitleEdit /convert sub1.srt sami
Result: Will convert sub1.srt to sub1.sub to SAMI formatExample 2:
SubtitleEdit /convert *.srt adobeencore
Result: Will convert all .srt files to Adobe Encore format
For Linux the command line needs to be slightly longer…
Syntax:
mono SubtitleEdit.exe /convert "pattern" "name-of-format-without-spaces"
…but could easily be wrapped in a script.
Solution 5
I found that some players (e.g., Google Drive video player) do not like the .srt generated from:
ffmpeg -i subtitles.ass <blah>.srt
or:
SubtitleEdit /convert subtitles.ass subrip
but:
ffmpeg -i subtitles.ass -codec:s text subtitles.srt
...did the trick for me.
Related videos on Youtube
Szakacs Botond
Updated on September 17, 2022Comments
-
Szakacs Botond almost 2 years
Are there any open source, command line, subtitle converters - preferably for Linux?
-
Szakacs Botond over 14 yearsSimple text subtitles. SRT, STL, SUB, PAC. Back and forth.
-
Szakacs Botond over 14 yearsIndeed this is handy, sadly though only three different formats are supported; .srt, .sub, .smi.
-
Shevek over 14 years@johnas - my answer updated with a couple of possibilities
-
Szakacs Botond over 14 yearsThanks Shevek, but none of the above was command line operational. Though they would've been perfect if I could use the GUI.
-
Szakacs Botond over 14 yearsI checked the Mplayer and Mencoder out. Didnt get it working though. And it supports only SRT, SMI, SUB and JACO. A good suggestion though, thanks.
-
Peter.O over 12 yearsThe GUI works, but I got an error when running from the command line.. .I needed to install
libmono-winforms
for the GUI to work (as stated in the README)... Maybe there is something extra which is needed for the CLI to work... I get anAttachConsole...
error. using Ubuntu 10.04 ... -
Johanz over 12 yearsThis seems to be fixed in version 3.2.3 - at least on Ubuntu
-
Peter.O over 12 years@Johanz: Thanks. Version 3.2.3 works. It converted a
.ass
to SubRip (.srt) ... Just one thing I notieced: it produces\r\n
(CRLF) line endings, even when the source line-ending is\n
... but that would rarely be a problem and is easily fixed withsed
if need be. -
Lukasz Frankowski almost 12 yearsWorks nice, thanks! Here: pastebin.com/T6DM9xbq is my converter based on this with framerate detection using mplayer
-
user10607 almost 9 years+1 as this is a really good converter and an open source application. And it has a cmd line interface.
-
Kamil Maciorowski almost 5 yearsWhat if the file name is
big.assassins.assured
(plus the extension)? Yoursed
will name itbigassinsured
. Withoutsed
and without this flaw:"${i%.ass}.srt"
. -
174140 almost 5 yearsWhat if Ffmpeg aborts?
-
Learning almost 5 yearsffmpeg is open source multimedia library.
-
IvanP almost 4 yearsThat tool can convert anything :)
-
Sxilderik over 3 years
for i in *.ass ; do ffmpeg -i "$i" "${i%.*}.srt" ; done
-
DUO Labs over 3 years@IvanP Apparently not ttml to $x$, though :(
-
jewishmoses almost 3 yearskeeps surprising me every time!