Created
October 17, 2022 19:29
-
-
Save tayiorbeii/d359ea0b922ac613eb98b370fe9587af to your computer and use it in GitHub Desktop.
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
| import "@johnlindquist/kit" | |
| const replaceAll = await npm('just-replace-all') | |
| // Name: | |
| let cutsToMake = [ | |
| { | |
| "from": "00:00:46", | |
| "to": "00:58:47", | |
| "desc": "2022-09-15 edited" | |
| }, | |
| ] | |
| // from to desc | |
| /* | |
| * Highlight the long video we are taking clips out of in Finder | |
| */ | |
| let longVideoFile = await getSelectedFile() | |
| /** | |
| * Tell kit we want to be working in the same directory as the source file | |
| */ | |
| cd(path.dirname(longVideoFile)) | |
| for (let cut of cutsToMake) { | |
| let fadeLength = 1 | |
| let clipFileName = `${replaceAll(cut.desc, ' ', '_')}.mp4` | |
| await exec(`ffmpeg -i "${longVideoFile}" -c copy -ss ${cut.from} ${cut.to ? `-to ${cut.to}`: ''} ${clipFileName}`) | |
| let { stdout } = await exec(`ffprobe -loglevel error -show_entries format=duration -of default=nk=1:nw=1 "${clipFileName}"`) | |
| let totalDuration = stdout | |
| let offset = totalDuration - fadeLength | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment