video-scene-groups

Find groups of scenes in an array of phashes using hierarchical clustering

Usage no npm install needed!

<script type="module">
  import videoSceneGroups from 'https://cdn.skypack.dev/video-scene-groups';
</script>

README

video-scene-groups

NPM version Build status Test coverage Dependency Status License Downloads Gittip

Find groups of scenes in an array of phashes using hierarchical clustering Pretty raw data, so you'll need to format the results yourself.

API

var detect = require('video-scene-groups');
var Extract = require('video-extract');

var extract = Extract('video.mp4');
extract.phashes.then(function (phashes) {
  var levels = detect(phashes)
  var last = levels[levels.length - 1]
  var clusters = last.clusters.filter(function (cluster) {
    return cluster.length > 1 // not really a group, otherwise
  }).map(function (cluster) {
    return cluster.sort() // sort by index, ascending
  })
  // clusters are arrays of frames in a scene group
  // you want to calculate scenes and match it with scene groups
})

var levels = detect(phashes, [threshold])

  • phashes - array of phashes
  • threshold - maximum phash distance to cluster with