Remove a media file's container and global metadata tags, together with any
chapters, and write a de-identified copy. The tags include creation time,
GPS or other location, device make and model, title and comment. Use it to
de-identify research recordings, for example for an IRB (a research ethics
board). The audio and video streams are stream-copied, not re-encoded. So the operation is
lossless and fast, and the picture and sound are bit-for-bit unchanged. That
includes any rotation display matrix, which is stream side data and not a
metadata tag. The glossary in vignette("tidymedia") explains media
terms such as container, stream and stream copy.
Arguments
- infile
A string containing the path to a media file.
- outfile
A string containing the path of the de-identified file to write. Use the same container extension as
infileso the copied streams remux cleanly.- run
A logical: run the command through FFmpeg (
TRUE, default) or return the compiled command without running it (FALSE).
Details
The output is written bit-exactly (-fflags +bitexact). So FFmpeg does
not stamp the container again with a fresh creation_time, or with an
encoder tag that names its own version. Either tag would defeat
de-identification and reproducibility.
Because the streams are copied and not re-encoded, some data is not removed.
Those are identifiers inside the encoded bitstream, and per-stream
metadata such as handler_name or language. Removing them would
require one of two things. One is re-encoding, which is out of scope for this
function, so use the direct command ffmpeg for it. The other
is per-stream metadata mapping that must probe the file first.
See also
anonymize_video() removes faces or regions from the picture, for
visual de-identification. probe_container() and mediainfo_query()
inspect a file's metadata before and after. This function wraps the
pipeline functions ffm_copy() and ffm_output_options().
strip_metadata_batch() is the many-file form.
Other task functions:
anonymize_video(),
anonymize_video_batch(),
compare_videos(),
compare_videos_batch(),
concatenate_videos(),
concatenate_videos_batch(),
convert_audio(),
convert_audio_batch(),
crop_video(),
crop_video_batch(),
extract_audio(),
extract_audio_batch(),
extract_frame(),
extract_frame_batch(),
format_for_web(),
format_for_web_batch(),
normalize_audio(),
normalize_audio_batch(),
picture_in_picture(),
picture_in_picture_batch(),
sample_frames(),
sample_frames_batch(),
segment_video(),
segment_video_batch(),
separate_audio_video(),
separate_audio_video_batch(),
standardize_video(),
standardize_video_batch(),
strip_metadata_batch()
Examples
video <- system.file("extdata", "sample.mp4", package = "tidymedia")
strip_metadata(video, "clean.mp4", run = FALSE)
#> [1] "-y -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -codec:v copy -codec:a copy -map_metadata -1 -map_chapters -1 -fflags +bitexact -map \"0\" \"clean.mp4\""