Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio replacement #985

Closed
piedasing opened this issue Apr 29, 2024 · 12 comments
Closed

Audio replacement #985

piedasing opened this issue Apr 29, 2024 · 12 comments

Comments

@piedasing
Copy link

Version
After Effects 2024 (24.x)
OS: windows 10
Node.js: v18.16.0

Description
I'm using Node.js to automation replacement text, image and audio.

This project has been running for at least 3 years until last week I discovered that the old version of AE 2017 (14.x) is no longer supported, so I now have to upgrade to the AE version (24.x).

Problem
I encountered the problem that after replacing the audio, the output video had no sound.

I have used the command line to directly call aerender.exe for output, and the result is no sound, too.

"C:\Program Files\Adobe\Adobe After Effects 2024\Support Files\aerender.exe" -project C:\aerender\AErender.aep -comp "Output 1080p" -sound ON -output C:\aerender\output\result.mp4 -OMtemplate "H.264 - Match Render Settings - 15 Mbps" -RStemplate 180p -r C:\aerender\temp\9lUDJVASh3dN7B3zVPdGj\nexrender-9lUDJVASh3dN7B3zVPdGj-script.jsx

my assets JSON

if (assets_data.type == "image") {
      job.assets.push({
        src: assets_data.src,
        type: "image",
        layerName: (assets_data.key) + ".jpg",
        composition: "*",
      });
} else if (assets_data.type == "audio") {
      const musicPath = await transfer_mp3_to_wav(
        /^http/.test(assets_data.src) ? assets_data.src : `file:///${assets_data.src}`
      );
      job.assets.push({
        src: musicPath,
        type: "audio",
        layerName: "BGM",
        composition: "*",
      });
}

nextrender-script.jsx

// image
(function() {
    nexrender.selectLayersByName('*', 'L01.jpg', function(layer) {
        nexrender.replaceFootage(layer, 'C:\\aerender\\temp\\9lUDJVASh3dN7B3zVPdGj\\twht617Uu654c93802f212ec721bc3311529574f8a.jpg')
    }, null, undefined);
})();

// audio
(function() {
    nexrender.selectLayersByName('*', 'BGM', function(layer) {
        nexrender.replaceFootage(layer, 'C:\\aerender\\temp\\9lUDJVASh3dN7B3zVPdGj\\default_bgm.wav')
    }, null, undefined);
})();

I found that the replacement programs for image and audio are very similar, but image can be replaced correctly, only audio cannot.

I suspect that the new version of aerender.exe has been some adjusted, so lead to the generated nexrender-{workDir}-script.jsx code to not be replaced the audio tracks correctly.

The following Result1 and Result2 are the output video infomation.
Result1. use the audio track in .aep (not add audio to replacement assets)
default_audio

Result2. add audio to replacement assets
replace_audio

The Result1 has sound, which means my .aep is fine.
But In the Result2, we can see that the description of the audio is empty, so it has no sound, but I provide the audio file is the same as file in AE project.

I need assistance with any aerender.exe replacement for audio, please.

@inlife
Copy link
Owner

inlife commented Apr 29, 2024

I wonder could it be related to the Output Module settings?

I've never experienced anything like this.

@piedasing
Copy link
Author

I wonder could it be related to the Output Module settings?

I've never experienced anything like this.

I've tried these configs

  1. avi
{
    outputModule: "Lossless"
}
  1. mp4
{
    outputModule: "H.264 - Match Render Settings - 15 Mbps"
    outputExt: "mp4",
}

@inlife
Copy link
Owner

inlife commented Apr 29, 2024

Could you also try one other thing, open the project inside AE, and run the script generated by nexrender. It should replicate the substituted assets of the project inside of your AE.

Please review the audio layer if it looks correct and if the composition itself correctly plays back the audio when you play it.

@piedasing
Copy link
Author

1714407340433

I've checked my AE project can play the audio in preview mode, and render by AME or Render Queue are also working well.

So, I think it's not setting issue in AE, but maybe a property issue from the nexrender script to aerender.exe.
(Maybe there are some changes in the latest aerender.exe)

@inlife
Copy link
Owner

inlife commented Apr 29, 2024

Can you confirm you checked this with an executed script and assets already replaced to the ones you were testing with initially?

@piedasing
Copy link
Author

If rendering is excuted via script, only text and images will work, except audio.

@piedasing
Copy link
Author

piedasing commented Apr 29, 2024

But if I use the old version of AE 2017 (14.x), the audio can also be replaced correctly.
(I wouldn't want to upgrade if I could, but the plan doesn't allow it. 😓)

That’s why I suspected it was caused by changes in the new version of AE.

@piedasing
Copy link
Author

Here's the log of rendering via script.

Adobe After Effects v24.3 Windows 64 render log for project “AErender.aep”

Rendering started on 2024/4/30 at 上午 12:26:43


  2024/4/30 上午 12:26:44: Starting composition “Output 1080p”.


  Render Settings: 180p
  Quality: Best
  Resolution: Quarter
  Size: 1920 x 1080 (480 x 270)
  Proxy Use: Use No Proxies
  Effects: Current Settings
  Disk Cache: Read Only
  Color Depth: Current Settings
  Frame Blending: On for Checked Layers
  Field Render: Off
  Pulldown: Off
  Motion Blur: On for Checked Layers
  Solos: Current Settings
  Time Span: Work Area
  Start: 0:00:00:00
  End: 0:02:59:23
  Duration: 0:03:00:00
  Frame Rate: 24.00 (comp)
  Guide Layers: All Off
  Skip Existing Files: Off
  
  Output Module: H.264 - Match Render Settings - 15 Mbps
  Output To: C:\aerender\temp\wrfhmRdZBRPKTkbyW06aK\result.mp4
  Format: H.264
  Output Info: VBR, Target 15.00 Mbps
  Include: Project Link
  Output Audio: On (if comp has audio)
  Channels: RGB
  Depth: Millions of Colors
  Color: Premultiplied
  Resize: -
  Crop: -
  Final Size: 480 x 270
  Profile: -
  Post-Render Action: None

  0:00:00:00 (1): 1 Seconds
  0:00:00:01 (2): 0 Seconds
  ...
  ...
  ...
  0:02:59:22 (4319): 0 Seconds
  0:02:59:23 (4320): 0 Seconds
  2024/4/30 上午 12:28:07: Finished composition “Output 1080p”.

  Total Time Elapsed: 1 Min, 21 Sec

Log closed on 2024/4/30 at 上午 12:28:08

@inlife
Copy link
Owner

inlife commented May 7, 2024

What happens if you open the project in After Effects GUI, and then run a nexrender-generated script via File > Scripts > Run script file. If you then run preview inside of AE interface, will the composition still have audio?

@piedasing
Copy link
Author

Thanks for the test method.
It will make audio track disappear...
After my continuous testing, I think I found the problem where it is !!!
The comp name is duplicate to the audio layer name, so the script replaced fail.
But it was okay on old version (AE 14.X)

I will continue to test whether there are other problems, thank you for your help, much appreciated.

@inlife
Copy link
Owner

inlife commented May 8, 2024

Oh, I see. The problem is quite complex. I wonder why version upgrade changed this.

@piedasing
Copy link
Author

I don’t know much about AE related operations, I’m just an frontend engineer for writing nodejs programs. 😅
And I don't want to upgrade if I can, because there are at least 20 videos in this project, which means I need to check them one by one, which will definitely take a lot of time.

But contrary to expectations, Adobe's plan no longer includes AE 2017 (14.X). If I don't upgrade the AE version, I won't be able to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants