inlife/nexrender

Nextrender is taking so much time to process and video rendering.

vimaloneuser opened this issue · 1 comments

I have developed one .aep file using after Effects and I am dynamically generating video with custom JSON using nextrender. Everytime when try to generate new video then it is taking min 10 min to generate video, can you help me optimizing it?

My JSON:
{
"template": {
"src": "file:///D:/video_project/Test/T1.aep",
"composition": "Comp 1",
"outputModule": "H.264 - Match Render Settings - 15 Mbps",
"outputExt": "mp4",
"settingsTemplate": "Best Settings"
},
"assets": [
{
"type": "data",
"layerName": "02.08.2023",
"value": "02.08.2023",
"property": "Source Text",
"screen": "1"
},
{
"type": "data",
"layerName": "Moran & Shimi",
"value": "Moran & Shimi",
"property": "Source Text",
"screen": "1"
},
{
"type": "data",
"layerName": "Moran & Shimi 2",
"value": "Moran & Shimi",
"property": "Source Text",
"screen": "2"
},
{
"type": "data",
"layerName": "YOU ARE INVITED TO OUR WEDDING",
"value": "YOU ARE INVITED TO OUR WEDDING",
"property": "Source Text",
"screen": "2"
},
{
"type": "data",
"layerName": "WEDNESDAY 2.8.2023",
"value": "WEDNESDAY 2.8.2023",
"property": "Source Text",
"screen": "2"
},
{
"type": "data",
"layerName": "18:30",
"value": "18:30",
"property": "Source Text",
"fontSize": 14,
"screen": "2"
},
{
"type": "data",
"layerName": "19:30",
"value": "19:30",
"property": "Source Text",
"fontSize": 14,
"screen": "2"
},
{
"type": "data",
"layerName": "Marriage",
"value": "Marriage",
"property": "Source Text",
"fontSize": 14,
"screen": "2"
},
{
"type": "data",
"layerName": "Reception",
"value": "Reception",
"property": "Source Text",
"fontSize": 14,
"screen": "2"
},
{
"type": "data",
"layerName": "BAIT AL AYAM",
"value": "BAIT AL AYAM",
"property": "Source Text",
"screen": "3"
},
{
"type": "data",
"layerName": "ARLOZOROV 10, TEL AVIV",
"value": "ARLOZOROV 10, TEL AVIV",
"property": "Source Text",
"screen": "3"
},
{
"type": "data",
"layerName": "SEE YOU THERE",
"value": "SEE YOU THERE",
"property": "Source Text",
"screen": "4"
},
{
"type": "data",
"layerName": "GROOM PARENTS SIGALIT AND YORAM COHEN",
"value": "GROOM PARENTS SIGALIT AND YORAM COHEN",
"property": "Source Text",
"screen": "4"
},
{
"type": "data",
"layerName": "BRIDE PARENTS LIORA AND OSHER LEVY",
"value": "BRIDE PARENTS LIORA AND OSHER LEVY",
"property": "Source Text",
"screen": "4"
},
{
"type": "data",
"layerName": "PLEASE DO NOT LATE Parking lot at the area",
"value": "PLEASE DO NOT LATE Parking lot at the area",
"property": "Source Text",
"screen": "4"
}
],
"actions": {
"postrender": [
{
"module": "@nexrender/action-encode",
"preset": "mp4",
"output": "encoded-new.mp4"
},
{
"module": "@nexrender/action-copy",
"input": "encoded-new.mp4",
"output": "D:/video_project/Node/easy-event/results/T1.mp4"
}
]
}
}

My nextrender implementation code:

    ```
      const templatePath = `file:///D:/test/${userId}.aep`;
              // Define the output path for the rendered video
              const outputPath = `D:/v/Node/test/${outputFileName}.mp4`;
              const main = async () => {
                const newJsonData = {
                  ...jsonData,
                  binaryPath: "D:/video_project/test/aerender.exe",
                  template: {
                    ...jsonData.template,
                    src: `${templatePath}`
                  },
                  actions: {
                    ...jsonData.actions,
                    postrender: jsonData?.actions?.postrender?.map(ele => {
                      if (ele.module === '@nexrender/action-copy') {
                        return {
                          ...ele,
                          output: outputPath
                        }
                      } else {
                        return ele
                      }
                    }),
                  },
        assets: JSON.parse(req.body.body)
      }

      // Render the video
      const result = await render(newJsonData);
      if (result.error) {
        throw new Error(result.error);
      }
    }
    await main().then(data => {}).finally(() => {
      (async () => {
        try {
          const data = await fs.promises.readFile(`./test/${outputFileName}.mp4`);
          const base64Data = base64.fromByteArray(data);
          console.log('we are processed at postmethod');

          const updateData = {
            status: 1
          };
          const response = await axios.put(`http://api.example.com/api/v1/${apiData.id}`, updateData);

          // res.status(200).json({ status: 200, data: { name: `${userId}.mp4`, fileData: base64Data, }, massage: `Video rendered successfully!` });
        } catch (err) {
          // Handle read file error if needed
          console.error("Error reading file:", err);
        }
      })();
      console.log('done')
    }).catch(console.error)
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.