nodeJs批量抽取视频某一帧保存为图片

2020-07-16  本文已影响0人  芸芸众生ing

const fs = require('fs');
const PATH = require('path');
const { exec } = require('child_process');
let rootPath = E:\\dev;
var saveDir = 'image';
let arr = [];
let obj = querydir(rootPath);
var classId = null;
function layer(b) {
b.forEach(e => {
if (e.child && e.child.length) {
layer(e.child)
} else if (!e.child) {
arr.push(e)
}
})
}
layer(obj);
let str = JSON.stringify(arr, "", "\t");
write('./data.json', str)

/**

/**

function createDir(path) {
// console.log(path);
if (!path) return false;
path = path.replace(//[\w_.?=\w\d]+$/, '');
let pathArr = PATH.normalize(path).split('\');
let a = '';
pathArr.forEach(e => {
a += e;
if (!fs.existsSync(a)) {
fs.mkdirSync(a)
}
a += '\';
})
return true
}

上一篇 下一篇

猜你喜欢

热点阅读