write_srt: Write subtitle data frame as SubRip text file

Description Usage Arguments Details Value Examples

View source: R/write.R

Description

Write subtitle data frame as SubRip text file

Usage

1
write_srt(x, path = NULL, wrap = TRUE, width = 40)

Arguments

x

A subtitle data frame from read_srt().

path

File or connection to write to.

wrap

If TRUE (default), subtitle lines will be wrapped.

width

If wrap is TRUE, the width of each wrapped subtitle.

Details

The SubRip text files format subtitles with four components separated by a blank line:

  1. A numeric counter identifying each sequential subtitle

  2. The time that the subtitle should appear on the screen, followed by --> and the time it should disappear

  3. Subtitle text itself on one or more lines

  4. A blank line containing no text, indicating the end of this subtitle

Value

The path to the written file, invisibly.

Examples

1
2
3
# read and write without line breaks
x <- read_srt(srt_example(1), collapse = " ")
write_srt(x, tempfile(fileext = ".srt"), wrap = FALSE)

srt documentation built on Nov. 30, 2020, 9:06 a.m.