jbilcke-hf HF staff commited on
Commit
dde59e8
·
1 Parent(s): b1df030

trying something

Browse files
src/bug-in-bun/aitube_ffmpeg/overlay/imageToVideoBase64.ts CHANGED
@@ -1,6 +1,7 @@
1
  import { rm, writeFile, readFile } from "node:fs/promises"
2
  import path from "node:path"
3
 
 
4
  import ffmpeg from "fluent-ffmpeg"
5
  import { getRandomDirectory } from "@aitube/io"
6
 
@@ -60,11 +61,11 @@ export async function imageToVideoBase64({
60
  // Decode the Base64 image and write it to a temporary file.
61
  const base64Data = inputImageInBase64.substring(inputImageInBase64.indexOf(',') + 1);
62
  const buffer = Buffer.from(base64Data, 'base64');
63
- const inputImagePath = path.join(outputDir, 'inputImage.png');
64
  await writeFile(inputImagePath, buffer);
65
 
66
  // Set the path for the output video.
67
- outputFilePath = outputFilePath || path.join(outputDir, `output.${outputVideoFormat}`);
68
 
69
  const durationInSeconds = outputVideoDurationInMs / 1000;
70
 
 
1
  import { rm, writeFile, readFile } from "node:fs/promises"
2
  import path from "node:path"
3
 
4
+ import { v4 as uuidv4 } from "uuid"
5
  import ffmpeg from "fluent-ffmpeg"
6
  import { getRandomDirectory } from "@aitube/io"
7
 
 
61
  // Decode the Base64 image and write it to a temporary file.
62
  const base64Data = inputImageInBase64.substring(inputImageInBase64.indexOf(',') + 1);
63
  const buffer = Buffer.from(base64Data, 'base64');
64
+ const inputImagePath = path.join(outputDir, `${uuidv4()}.png`)
65
  await writeFile(inputImagePath, buffer);
66
 
67
  // Set the path for the output video.
68
+ outputFilePath = outputFilePath || path.join(outputDir, `output_${uuidv4()}.${outputVideoFormat}`);
69
 
70
  const durationInSeconds = outputVideoDurationInMs / 1000;
71