Write subtitle data frame as SubRip text file
write_srt(x, path = NULL, wrap = TRUE, width = 40)
A subtitle data frame from read_srt()
.
File or connection to write to.
If TRUE
(default), subtitle lines will be wrapped.
If wrap
is TRUE
, the width of each wrapped subtitle.
The path to the written file, invisibly.
The SubRip text files format subtitles with four components separated by a blank line:
A numeric counter identifying each sequential subtitle
The time that the subtitle should appear on the screen, followed by -->
and the time it should disappear
Subtitle text itself on one or more lines
A blank line containing no text, indicating the end of this subtitle
# read and write without line breaks
x <- read_srt(srt_example(), collapse = " ")
write_srt(x, tempfile(fileext = ".srt"), wrap = FALSE)