0

I am running a command that renders images and then compiles them into an mp4 from blender via node/ command line.

It works perfectly well until I need to render over 200 images. It gets to around that number and then throws this error:

<ref *1> Error: spawnSync C:\WINDOWS\system32\cmd.exe ENOBUFS
    at Object.spawnSync (node:internal/child_process:1083:20)
    at spawnSync (node:child_process:812:24)      
    at execSync (node:child_process:895:15)       
    at D:\cubeOutput_node\index.js:72:21
    at new Promise (<anonymous>)
    at commandPromise (D:\cubeOutput_node\index.js:70:12)
    at init (D:\cubeOutput_node\index.js:85:11)   
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4060,
  code: 'ENOBUFS',
  syscall: 'spawnSync C:\\WINDOWS\\system32\\cmd.exe',
  path: 'C:\\WINDOWS\\system32\\cmd.exe',
  spawnargs: [
    '/d',
    '/s',
    '/c',
    '"D:\\/Blender/blender.exe -noaudio -b D:\\cubeOutput_node/blenderParts/cubeOutput.blend -o D:\\cubeOutput_node/output/image_##### -s 1 -e 250 -a"'
  ],

Here is the code I'm running. I'm not great on promises/ async so any corrections are greatly appreciated.

const commandPromise = async (command, type) => {
    console.log(`${type} started...`.bold.yellow)

    return new Promise(async (resolve, reject) => {
        try{
            resolve(execSync(command))
        }catch(err){
            reject(console.log(`Oops, ${type} failed.\n`.bold.red, err))
        }
    })
}

async function init(){
    writeCoords()

    await commandPromise(constructCommand, 'building statue')
    console.log('Statue constructed.'.bold.green)

    await commandPromise(renderCommand, 'image rendering')
    console.log('images rendered.'.bold.green)

    await commandPromise(videoRenderCommand, 'video rendering')
    console.log('video rendered.'.bold.green)

    console.log('success.'.rainbow)
}

init()

And here are my commands:

const constructCommand = `${blenderEXEFilepath} -b ${blenderConstructorFilepath} --python ${constructorScriptFilePath} -- "test" ${cubeCoordsFilepath}`
const renderCommand = `${blenderEXEFilepath} -noaudio -b ${blenderConstructorFilepath} -o ${blenderOutputFilepath} -s 1 -e 200 -a`
const videoRenderCommand = `ffmpeg -r 60 -s 600x600 -start_number 00001 -i ${thisDir + '/output/image_%5d.jpg'} -vcodec libx264 -preset veryslow -crf 18 -pix_fmt yuv420p -r 60 ${thisDir + '/output/media.mp4'}`

As I said, it works fine up until I need to render the actual full animation's worth of images.

  • 1
    What makes you think it's "timing out"? – Thomas Feb 16 '22 at 13:10
  • Well it's a pretty rudimentary conclusion to come to I know - but because it works when I render anything under 200 frames. I Did see that it may be something to do with buffer memory but I don't know enough about it to ask a meaningful question I suppose. – EdelweissPirate Feb 16 '22 at 13:25

0 Answers0