Ajouter la prise en charge de la résolution personnalisée lors de la création de vidéos

This commit is contained in:
2025-03-31 11:22:19 +02:00
parent 6c48612554
commit 9101497a7f
2 changed files with 10 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ async function deleteVideoProject(videoId) {
return res.rows[0];
}
async function createVideoWithList(projectId, pathList, duration, videoId) {
async function createVideoWithList(projectId, pathList, duration, videoId, res_width, res_height) {
const tempFile = path.join('temp.txt');
let ffmpegProcess;
let cleanupDone = false;
@@ -76,6 +76,7 @@ async function createVideoWithList(projectId, pathList, duration, videoId) {
eta = NULL
WHERE id = $1
`, [videoId]);
const scale = res_width && res_height ? `scale=${res_width}:${res_height}` : 'scale=854:480'; // Redimensionne la vidéo en 480p par défaut
// Configuration de FFmpeg
const ffmpegArgs = [
@@ -86,7 +87,7 @@ async function createVideoWithList(projectId, pathList, duration, videoId) {
'-i', tempFile,
'-vsync', 'vfr',
'-pix_fmt', 'yuv420p',
'-vf', 'scale=854:480', // Redimensionne la vidéo en 480p
'-vf', scale,
'-b:v', '1500k', // Force un bitrate vidéo de 1500 kbps (ajuste si nécessaire)
outputVideo
];