ov_editry_clips | R Documentation |
Note that in order to use ov_editry_clips
, the editry
package must be installed. Install it with: remotes::install_github('scienceuntangled/editry')
or install.packages('editry', repos = c('https://openvolley.r-universe.dev', 'https://cloud.r-project.org'))
. The editry
package also requires editly
(the underlying node JS package: see editry::er_install_editly()
).
ov_editry_clips(
playlist,
title = NULL,
title2 = NULL,
label_col,
pause = TRUE,
seamless = FALSE,
title_args = list(),
title2_args = list(),
pause_args = list(),
label_args = list()
)
playlist |
data.frame: a playlist as returned by |
title |
string: the title text (first slide). Use |
title2 |
string: the second title text (on the second slide). Use |
label_col |
string: the name of the column in |
pause |
logical: if |
seamless |
logical: if |
title_args |
list: arguments to pass to |
title2_args |
list: arguments to pass to |
pause_args |
list: arguments to pass to |
label_args |
list: arguments to pass to |
A list of editry::er_clip()
objects, suitable to pass to editry::er_spec()
editry::er_layer_news_title()
, editry::er_layer()
, editry::er_spec()
## Not run:
## Example 1
## Step 1: create our playlist
## use data from the ovdata package
library(ovdata) ## install via remotes::install_github("openvolley/ovdata") if needed
x <- ovdata_example("190301_kats_beds-clip", as = "parsed")
## make sure its video element points to our local copy of the corresponding video clip
dv_meta_video(x) <- ovdata_example_video("190301_kats_beds")
## extract the plays
px <- datavolley::plays(x)
## use just the attack rows
px <- px[which(px$skill == "Attack"), ]
## make a new column with player name and attack type
px$label <- paste(px$player_name, px$attack_code, "attack")
## make the playlist with the new label column included
tm <- ov_video_timing(Attack = c(-3, 2)) ## tighter than normal timing
ply <- ov_video_playlist(px, x$meta, extra_cols = "label", timing = tm)
## Step 2: convert to editly clip objects and compile to mp4
library(editry)
## create the clips, one for each row of the playlist
clips <- ov_editry_clips(ply, title = "GKS Katowice\nvs\nMKS Bedzin",
title2 = "Attacks", label_col = "label")
## compile to video
outfile <- tempfile(fileext = ".mp4")
my_spec <- er_spec(out_path = outfile, clips = clips)
er_exec_wait(spec = my_spec, fast = TRUE)
## and view the output
if (interactive()) browseURL(outfile)
## ---
## Example 2
## without a playlist, make a simple clip from a known segment of video
library(editry)
library(ovdata) ## install via remotes::install_github("openvolley/ovdata") if needed
my_video <- ovdata_example_video("190301_kats_beds") ## path to your video file
my_logo <- "https://github.com/openvolley/community/raw/master/docs/talks/common/ovlogo-blur.png"
clips <- list(er_clip_video(path = my_video, cut_from = 1, cut_to = 8), ## video segment
## add an outro banner with logo
er_clip(duration = 1.5, layers = list(er_layer_fill_color(),
er_layer_image(path = my_logo))),
## and blank finishing screen
er_clip_pause(duration = 0.25))
outfile <- tempfile(fileext = ".mp4")
my_spec <- er_spec(clips = clips, out_path = outfile, allow_remote_requests = TRUE)
er_exec_wait(spec = my_spec, fast = TRUE)
if (interactive()) browseURL(outfile)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.