% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/record.R
\name{cgv_record_start}
\alias{cgv_record_start}
\title{Start Recording the Viewer to a Video File}
\usage{
cgv_record_start(
  viewer,
  file,
  fps = 30L,
  duration = NA_real_,
  ffmpeg_args = NULL
)
}
\arguments{
\item{viewer}{External pointer from \code{cgv_viewer()}. The window must
already be running (call this from a frame callback, or after
\code{cgv_run()} has built the canvas — typically by setting a
\code{duration} and starting recording before \code{cgv_run()}).}

\item{file}{Output path; extension determines the format.}

\item{fps}{Frames per second (default 30).}

\item{duration}{Optional cap in seconds; \code{NA} = unlimited.}

\item{ffmpeg_args}{Optional extra ffmpeg flags spliced before the output
path (e.g. \code{"-c:v libvpx-vp9 -b:v 2M"}). \code{NULL} = use defaults
(libx264, yuv420p, veryfast).}
}
\value{
No return value, called for side effects: stores the recording
  parameters on the viewer; the ffmpeg pipe is opened lazily on the
  first rendered frame. Returns \code{NULL} invisibly.
}
\description{
Pipes raw RGB frames from the live canvas into \code{ffmpeg}, which
encodes them on the fly. The recording runs in the background while the
user keeps interacting with the viewer (mouse, keyboard).
}
\details{
Requires \code{ffmpeg} on PATH. The container/codec is chosen by the
file extension (\code{.mp4} / \code{.mkv} / \code{.webm} / etc.).
Frames are captured at the requested \code{fps}; if the rendering loop
produces frames faster, extras are dropped.

The recording is automatically stopped when the viewer is closed,
\code{cgv_record_stop()} is called, or the optional \code{duration}
elapses.
}
