File size: 799 Bytes
2f67628
3165afb
62e8997
3165afb
62e8997
2ed47da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44b5f05
 
 
 
 
 
 
2ed47da
6349b58
 
2ed47da
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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,
  }
}