// Name: Trim video with ffmpeg // Author: Ricardo Gonçalves Bassete import "@johnlindquist/kit" import { basename, dirname, extname } from "node:path" const inputPath = await selectFile('Select your video file') const start = await arg('Start (hh:mm:ss)') const end = await arg('End (hh:mm:ss)') const outputName = await arg('Output name') const fileDir = dirname(inputPath) const ext = extname(inputPath) const flags = [ `-i "${inputPath}"`, `-ss ${start}`, `-to ${end}`, `-c copy "${outputName}.${ext}"` ] cd(fileDir) await hide() await exec(`ffmpeg ${flags.join(' ')}`) notify({ title: "Trim video with ffmpeg", message: `Finished trimming ${basename(inputPath)}` })