ai-tube-clap-exporter / src /core /exporters /clapWithVideosToVideoFile.ts
jbilcke-hf's picture
jbilcke-hf HF staff
let's try dev mode
3165afb
raw
history blame
799 Bytes
import { ClapProject, ClapSegment } from "@aitube/clap"
import { getRandomDirectory } from "@aitube/io"
import { videoSegmentToVideoFile } from "./videoSegmentToVideoFile"
export async function clapWithVideosToVideoFile({
clap,
videoSegments = [],
outputDir = "",
}: {
clap: ClapProject
videoSegments: ClapSegment[]
outputDir?: string
}): Promise<{
outputDir: string
videoFilePaths: string[]
}> {
outputDir = outputDir || (await getRandomDirectory())
const videoFilePaths: string[] = await Promise.all(videoSegments.map(segment =>
videoSegmentToVideoFile({
clap,
segment,
outputDir,
})
))
console.log(`clapWithVideosToVideoFile: videoFilePaths: ${JSON.stringify(videoFilePaths, null, 2)}`)
return {
outputDir,
videoFilePaths,
}
}