Estoy ejecutando un comando que genera imágenes y luego las compila en un mp4 desde Blender a través de la línea de comando/nodo.
Funciona perfectamente bien hasta que necesito renderizar más de 200 imágenes. Llega a alrededor de ese número y luego arroja este 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"' ],Aquí está el código que estoy ejecutando. No soy muy bueno con las promesas/async, por lo que cualquier corrección es muy apreciada.
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()Y aquí están mis comandos:
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'}`Como dije, funciona bien hasta que necesito renderizar las imágenes de la animación completa real.