Created
April 10, 2020 18:14
-
-
Save wrannaman/18b06fd7fe8948dbd982f826e63a8373 to your computer and use it in GitHub Desktop.
rename + concat ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
run once wth first run | |
then run again with second run | |
then on the cli do | |
*/ | |
const fs = require('fs'); | |
const path = require('path'); | |
const where = "./Incident-27085843" | |
const fullPath = path.join(__dirname, where) | |
const list = `list.txt` | |
fs.readdir(fullPath, (err, items) => { | |
const names = []; | |
for (var i=0; i<items.length; i++) { | |
const name = items[i]; | |
// // rename and pad - first run | |
// if (name.indexOf('.mp4') !== -1) { | |
// const split = name.split('-') | |
// const pad = split[2].split('.'); | |
// const padded = pad[0].padStart(4, '0') | |
// console.log('PADDED', padded) | |
// fs.renameSync(`${fullPath}/${name}`, `${fullPath}/${padded}.mp4`) | |
// } | |
//// to generate concat list - 2nd run | |
// if (name.indexOf('.mp4') !== -1) names.push(`file '${fullPath}/${name}'`) | |
} | |
// // to generate concat list - 2nd run | |
// fs.writeFileSync(`${fullPath}/${list}`, names.join('\n')) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment