A first naive implementation looks promising.
Simply splitting the renders in two chunks, giving one chunk to one worker, once they are done, concatenate the output files with fluent-ffmpeg like this:
ffmpeg()
.input(chunksTxtPath) // Use the chunks.txt file as input
.inputFormat("concat") // Specify the concat format
.outputOptions("-safe 0") // Add the -safe 0 option
.outputOptions("-c copy") // Copy the streams without re-encoding
.save(outputFile) // Specify the output file
.on("end", () => {
console.log("Concatenation complete!");
})
.on("error", (err) => {
console.error("Error occurred:", err.message);
});
There's only one problem. The audio cuts off for a split second in the split frame.
Any ideas on how to solve this?
I believe one does not need to build a full blown distributed system with a concurrency/parallelism like Remotion Lambda to improve the render speed when using Docker-based renderers. Just by splitting in 2 is a 2x speed increase. I'd be happy with splitting into 4 chunks, where each chunk is rendered by a 4 vCPU container with a concurrency of 4.
It took 194 seconds to render 1m of an OffthreadVideo (1080@30). That's too slow for me. But split the rendering in just 4 chunks and we could be looking at a total render time that's under a minute. I'd be happy with it.