Modifier la fonction createVideoWithList pour accepter la durée et ajuster le frame rate en conséquence

This commit is contained in:
2025-03-10 17:08:11 +01:00
parent e9fd9dfaa1
commit 9e850f0090
2 changed files with 5 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ async function deleteVideoProject(videoId) {
return res.rows[0];
}
async function createVideoWithList(projectId, pathList) {
async function createVideoWithList(projectId, pathList, duration) {
//pathList étant la liste des chemins déjà triés
const tempFile = path.join('temp.txt');
try {
@@ -55,7 +55,7 @@ async function createVideoWithList(projectId, pathList) {
// Créer un fichier temporaire pour la liste des images
fs.writeFileSync(tempFile, sortedImages.map(image => `file '${image}'`).join('\n'));
const frameRate = 10;
const frameRate = Math.ceil(sortedImages.length / duration);
// le fichier final prend cette forme : {projectId}_{firstImageId}_{lastImageId}-{timestamp}.mp4
const timestamp = new Date().getTime();