ov_playlist_to_video: Playlist to video file

View source: R/ffmpeg_utils.R

ov_playlist_to_videoR Documentation

Playlist to video file

Description

Make a self-contained video file from a playlist.

Usage

ov_playlist_to_video(
  playlist,
  filename,
  subtitle_column = NULL,
  seamless = FALSE,
  debug = FALSE
)

Arguments

playlist

data.frame: a playlist as returned by ov_video_playlist. Note that only local video sources are supported

filename

string: file to write to. If not specified (or NULL), a file in the temporary directory will be created. If filename exists, it will be overwritten. The extension of filename will determine the output format

subtitle_column

string: if not NULL, a subtitle file will be produced using the contents of this column (in the playlist) as the subtitle for each clip. The subtitle file will have the same name as filename but with extension ".srt"

seamless

logical: if TRUE, combine overlapping/adjacent clips. Note that if a subtitle_col has been specified, the subtitle from the first clip will be used for the whole of the combined clip (so it may no longer make sense, for example if the subtitle is the player name)

debug

logical: if TRUE, echo the ffmpeg output to the console

Details

Requires that ffmpeg be available on the system path. Note that the processing of each clip is done inside of a future_lapply call (if the future.apply package is installed), and so you can have this part of the processing done in parallel by setting an appropriate futures plan before calling this function. This function is experimental. In particular it is unlikely to work well with all video formats, and especially if the playlist comprises clips from different videos with different resolution/encoding/etc.

Value

A list with the filenames of the created video and subtitle files.

See Also

ov_video_playlist()

Examples

## Not run: 
  my_playlist <- ov_video_playlist(..., type = "local")
  video_file <- ov_create_video(my_playlist)
  browseURL(video_file[[1]])

  ## run in parallel, with the scouted codes as subtitles
  library(dplyr)
  library(future.apply)
  plan(multisession)
  ## note that the example file doesn't have a video associated with it, so
  ##  this example won't actually work in practice
  x <- read_dv(dv_example_file())
  ## fudge the video entry
  dv_meta_video(x) <- "~/my_video.mp4"
  ## make the playlist
  my_playlist <- ov_video_playlist(
    x$plays %>% dplyr::filter(skill == "Reception") %>% slice(1:10),
    meta = x$meta, extra_cols = "code")
  ## create the video and subtitles files
  video_file <- ov_create_video(my_playlist, subtitle_column = "code")

## End(Not run)


openvolley/ovideo documentation built on March 19, 2024, 9:52 p.m.