Fix FFmpeg task when rendering list of frames #104286

Manually merged
Sybren A. Stüvel merged 2 commits from EmmanuelDurand/flamenco:fix/ffmpeg-list-of-frames into main 2024-02-24 11:58:25 +01:00
Contributor

This fixes issue #104285, by generating a name composed using the first and last frames of the given list of frames to render.

This fixes issue #104285, by generating a name composed using the first and last frames of the given list of frames to render.
paperManu added 1 commit 2024-02-22 20:20:43 +01:00
Sybren A. Stüvel requested changes 2024-02-23 08:40:32 +01:00
Sybren A. Stüvel left a comment
Owner

I can't reproduce the issue here (currently on my home computer running Windows 10), but I feel that this way of naming the video is nicer anyway.

There is one issue with the code, though, and that is that it assumes that any comma in outfile is caused by a comma in settings.frames. This may not be true, as stem or renderDir could also have a comma in them. If you replace the code with this, it should work:

    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];
        frames = `${firstFrame}-${lastFrame}`;
    }

    const stem = path.stem(settings.blendfile).replace('.flamenco', '');
    const outfile = path.join(renderDir, `${stem}-${frames}.mp4`);
I can't reproduce the issue here (currently on my home computer running Windows 10), but I feel that this way of naming the video is nicer anyway. There is one issue with the code, though, and that is that it assumes that any comma in `outfile` is caused by a comma in `settings.frames`. This may not be true, as `stem` or `renderDir` could also have a comma in them. If you replace the code with this, it should work: ```js 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]; frames = `${firstFrame}-${lastFrame}`; } const stem = path.stem(settings.blendfile).replace('.flamenco', ''); const outfile = path.join(renderDir, `${stem}-${frames}.mp4`); ```
Author
Contributor

Indeed, I forgot that it is possible to use commas in file and directory name. Must be an inner fear of such naming decisions ;)

Your proposition is much better, I'll push an update right now.

Indeed, I forgot that it is possible to use commas in file and directory name. Must be an inner fear of such naming decisions ;) Your proposition is much better, I'll push an update right now.
paperManu added 1 commit 2024-02-23 15:42:04 +01:00

Thanks!

Thanks!
Sybren A. Stüvel manually merged commit 1ffe0a10bd into main 2024-02-24 11:58:25 +01:00
Sybren A. Stüvel added this to the 3.5 milestone 2024-02-24 11:58:59 +01:00
Sign in to join this conversation.
No description provided.