drawFrames: This library provides tools to overlay signals on video

View source: R/graphics_videoframes.R

drawFramesR Documentation

This library provides tools to overlay signals on video

Description

to allow for multiple signals, everything must be a list of length n so if I have e.g. SC, HR and MEA, I must provide 3 dyadsignals, 3 y positions, etc

Usage

drawFrames(
  session,
  signals,
  inputDir,
  outputDir,
  inputFilePattern = ".mp4",
  idOrder = c(F, F, T),
  idSep = "_",
  overwrite = FALSE,
  sync = NA,
  WIN = 30,
  w = 1280,
  h = 720,
  frameRate = "auto",
  layout = c(1),
  col_sync = "default",
  signal_height = 0.3,
  ffmpeg.query = "default",
  ffmpeg_bin = "PATH",
  multi.core = TRUE,
  speed = 1,
  keepAudio = TRUE,
  ...
)

Arguments

session
signals
inputDir
outputDir
inputFilePattern
idOrder
idSep
overwrite

logical. Should existing files be deleted?

sync
WIN
w
h
frameRate
layout
col_sync
signal_height

0 to 1. vertical space of each signal, relative to the video frame

ffmpeg.query

"default" or a custom FFmpeg

ffmpeg_bin

'PATH' if FFmpeg is added to system environment. else full path to FFmpeg's bin directory.

multi.core

numeric to specify a number of cores to be used, or logical to enable/disable automatic multi-core computation.

speed

numeric

keepAudio

logical

...

Details

Directory organization Each of these endeavors require: - json file of the original acquisition - csv version for DyadSync import - video of the session in a suitable format - folders with all the frames - output video file THUS it would make sense to have a folder for each session instead of a folder for each 'type' of data

Default FFmpeg query: ffmpeg -y -thread_queue_size 1024 -i "inputDir/inputFile.mp4" -framerate 25 -i "framesDir/framesFileFormat" -r 25 -pix_fmt yuva420p -filter_complex " [0:v]scale=2*trunc(iw*sar/2):ih,setsar=1[0v_1]; [1:v]format=yuva420p,colorchannelmixer=aa=0.8[ckout]; [0v_1][ckout]overlay[resv]; [resv]setpts=1*PTS[resv]; [0:a]atempo=1[resa];" -map "[resv]" -c:v libx264 -map "[resa]" "outputDir/outputFile.mp4"

Examples

quindi il tempo tra 00:00 e start(signal) va riempito di frame bianchi
se start(signal) è == 00:00 bisogna aggiungere WIN/2 sample perché il primo sample
deve comparire al centro della finestra

kleinbub/rIP documentation built on Dec. 21, 2024, 9:15 a.m.