| verify_media | R Documentation |
Probe a media file and check its structural metadata against a set of expectations, returning a tidy pass/fail tibble with one row per checked property. A reproducible command tells you what ran. This function tells you whether the result is what you asked for. Use it after a conversion to confirm that the output has the duration, dimensions, codecs and other properties the pipeline was meant to produce.
verify_media(
file,
duration = NULL,
width = NULL,
height = NULL,
video_codec = NULL,
audio_codec = NULL,
sample_rate = NULL,
...,
tolerance = 0.1
)
file |
A string naming a single media file to verify. |
duration |
Expected container duration in seconds (numeric). |
width, height |
Expected video-frame dimensions in pixels (numeric). |
video_codec, audio_codec |
Expected codec names for the first video and
audio stream (strings, e.g. |
sample_rate |
Expected audio sample rate in Hz (numeric). |
... |
Further expectations given as |
tolerance |
The absolute tolerance for numeric checks (default |
The glossary in vignette("tidymedia") explains media terms such as codec,
stream and keyframe.
Checks are structural (drawn from FFprobe metadata), not perceptual: this
does not measure visual or audio quality. The named arguments cover the most
common properties; pass any other FFprobe field by name through ... (for
example pix_fmt = "yuv420p" or bit_rate = 141800). Extra names are
resolved against the probe columns in the order container, then video stream,
then audio stream, and the first match wins.
Numeric checks pass when abs(actual - expected) <= tolerance. With the
default tolerance of 0.1, whole-number properties (width, height, sample
rate) must match exactly. The duration check allows a small difference, for
example for cuts that snap to a keyframe. String checks (the codecs) must
match exactly. A property whose stream or column is absent yields an NA
actual value and a failing check.
A tibble with one row per checked property
and columns file, check, expected, actual, and pass (logical).
ffm_run() and ffm_batch(), which accept a verify = spec.
Other verification functions:
ffm_manifest()
video <- system.file("extdata", "sample.mp4", package = "tidymedia")
verify_media(video, width = 320, height = 240, video_codec = "h264")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.