Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 920 Bytes
46fcec6 2cae2a9 46fcec6 2cae2a9 46fcec6 2cae2a9 46fcec6 2cae2a9 46fcec6 2cae2a9 46fcec6 2cae2a9 |
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 36 37 |
import { createTextOverlayImage } from "./createTextOverlayImage.mts"
import { addImageToVideo } from "./addImageToVideo.mts"
import { deleteFile } from "../files/deleteFile.mts"
export async function addTextToVideo({
inputVideoPath,
outputVideoPath,
text,
width,
height,
}: {
inputVideoPath: string
outputVideoPath: string
text: string
width: number
height: number
}): Promise<string> {
const { filePath: temporaryImageOverlayFilePath } = await createTextOverlayImage({
text,
width,
height,
})
console.log("addTextToVideo: temporaryImageOverlayFilePath:", temporaryImageOverlayFilePath)
const pathToVideo = await addImageToVideo({
inputVideoPath,
inputImagePath: temporaryImageOverlayFilePath,
outputVideoPath,
})
await deleteFile(temporaryImageOverlayFilePath)
console.log("addTextToVideo: outputVideoPath:", outputVideoPath)
return outputVideoPath
} |