From 18339f4f523e93833aa10f43bda18e145c102faf Mon Sep 17 00:00:00 2001 From: Emmanuel Durand Date: Thu, 22 Feb 2024 13:59:58 -0500 Subject: [PATCH 1/2] Fix FFmpeg task when rendering list of frames --- .../scripts-for-unittest/simple_blender_render.js | 9 ++++++++- .../job_compilers/scripts/simple_blender_render.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js b/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js index 8db37ce7..e37e27d9 100644 --- a/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js +++ b/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js @@ -149,7 +149,14 @@ function authorCreateVideoTask(settings, renderDir) { } const stem = path.stem(settings.blendfile).replace('.flamenco', ''); - const outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`); + var outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`); + if (outfile.search(',') != -1) { + // Get the first and last frame from the list + const chunks = frameChunker(settings.frames, 1); + const firstFrame = chunks[0]; + const lastFrame = chunks.slice(-1)[0]; + outfile = path.join(renderDir, `${stem}-${firstFrame}-${lastFrame}.mp4`); + } const outfileExt = guessOutputFileExtension(settings); const task = author.Task('preview-video', 'ffmpeg'); diff --git a/internal/manager/job_compilers/scripts/simple_blender_render.js b/internal/manager/job_compilers/scripts/simple_blender_render.js index d69d4c9d..7a28e3df 100644 --- a/internal/manager/job_compilers/scripts/simple_blender_render.js +++ b/internal/manager/job_compilers/scripts/simple_blender_render.js @@ -130,7 +130,14 @@ function authorCreateVideoTask(settings, renderDir) { } const stem = path.stem(settings.blendfile).replace('.flamenco', ''); - const outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`); + var outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`); + if (outfile.search(',') != -1) { + // Get the first and last frame from the list + const chunks = frameChunker(settings.frames, 1); + const firstFrame = chunks[0]; + const lastFrame = chunks.slice(-1)[0]; + outfile = path.join(renderDir, `${stem}-${firstFrame}-${lastFrame}.mp4`); + } const outfileExt = needsPreviews ? ".jpg" : settings.image_file_extension; const task = author.Task('preview-video', 'ffmpeg'); -- 2.30.2 From 857fd53c6ddc83d8e70c27feb0f0bf109e07d3cf Mon Sep 17 00:00:00 2001 From: Emmanuel Durand Date: Fri, 23 Feb 2024 09:41:43 -0500 Subject: [PATCH 2/2] Fixes following comments --- .../scripts-for-unittest/simple_blender_render.js | 10 ++++++---- .../job_compilers/scripts/simple_blender_render.js | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js b/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js index e37e27d9..cbe73256 100644 --- a/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js +++ b/internal/manager/job_compilers/scripts-for-unittest/simple_blender_render.js @@ -148,15 +148,17 @@ function authorCreateVideoTask(settings, renderDir) { return; } - const stem = path.stem(settings.blendfile).replace('.flamenco', ''); - var outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`); - if (outfile.search(',') != -1) { + var frames = `${settings.frames}`; + if (frames.search(',') != -1) { // Get the first and last frame from the list const chunks = frameChunker(settings.frames, 1); const firstFrame = chunks[0]; const lastFrame = chunks.slice(-1)[0]; - outfile = path.join(renderDir, `${stem}-${firstFrame}-${lastFrame}.mp4`); + frames = `${firstFrame}-${lastFrame}`; } + + const stem = path.stem(settings.blendfile).replace('.flamenco', ''); + const outfile = path.join(renderDir, `${stem}-${frames}.mp4`); const outfileExt = guessOutputFileExtension(settings); const task = author.Task('preview-video', 'ffmpeg'); diff --git a/internal/manager/job_compilers/scripts/simple_blender_render.js b/internal/manager/job_compilers/scripts/simple_blender_render.js index 7a28e3df..d4a18672 100644 --- a/internal/manager/job_compilers/scripts/simple_blender_render.js +++ b/internal/manager/job_compilers/scripts/simple_blender_render.js @@ -129,15 +129,17 @@ function authorCreateVideoTask(settings, renderDir) { return; } - const stem = path.stem(settings.blendfile).replace('.flamenco', ''); - var outfile = path.join(renderDir, `${stem}-${settings.frames}.mp4`); - if (outfile.search(',') != -1) { + var frames = `${settings.frames}`; + if (frames.search(',') != -1) { // Get the first and last frame from the list const chunks = frameChunker(settings.frames, 1); const firstFrame = chunks[0]; const lastFrame = chunks.slice(-1)[0]; - outfile = path.join(renderDir, `${stem}-${firstFrame}-${lastFrame}.mp4`); + frames = `${firstFrame}-${lastFrame}`; } + + const stem = path.stem(settings.blendfile).replace('.flamenco', ''); + const outfile = path.join(renderDir, `${stem}-${frames}.mp4`); const outfileExt = needsPreviews ? ".jpg" : settings.image_file_extension; const task = author.Task('preview-video', 'ffmpeg'); -- 2.30.2