- In the code below I want to get the first 120 frames.
- Then I want to remove the sequentially duplicate ones
ffmpeg has a mpdecimate filter that is supposed to drop frames that don't vary greatly from each other.
But I don't know if there is an ffmpeg Js library (or equivalent) to do something like that within a p5.js context.
function setup() {
frameRate(24)
video = createCapture(VIDEO)
video.size(videoWidth, videoHeight)
video.hide()
createCanvas(canvasWidth, canvasWidth)
}
let frames = []
let uniqueFrames = []
let STOP = false
function draw() {
if (video && video.loadedmetadata && frameCount <= 100) {
frames.push(image(video.get()))
} else if (!STOP) {
STOP = true
uniqueFrames = removeDuplicates(frames)
}
}