Adding audio to MP4 in PDG

   1781   6   1
User Avatar
Member
164 posts
Joined: Feb. 2014
Offline
Hey,

I can output an MP4 in PDG using the ffmpegencodevideo node. I'm on a Mac also. I'm wondering can I add my audio to that?
I generally use audio in CHOP's, so linking a CHOP node would be ideal. But even if it's just an audio file from an external aif etc that would be very helpful.
Any help appreciated.

Thanks
Edited by Simon Russell - May 4, 2021 06:04:47
http://simonfarussell.com [simonfarussell.com]
User Avatar
Member
1745 posts
Joined: May 2006
Offline
Hey Simon, figured I'd post the answer here too in case others get stuck.

I've attached an example using tops. The workflow is:

-define a path to save the audio to, store it as an attribute
-fetch a chop rop to render the audio to that location (setting the path with tops attrs, ie @audio_path)
-render the flipbook
-render a mp4, using a modified ffmpeg command string to add an extra input, -i @audio_path

Fetching the chops rop needs some minor tweaks. A tops fetch expects to keep track of the rop you link to, if it can't it generates warnings. The slight tweaks on the fetch are so that it understands which parameter on the chops rop is used for output.

The main thing is to keep track of where the audio lives, so the filename for the wav can be sent to ffmpeg. I found it was easiest just to define it within tops as an attribute. That way it can be sent over to the chops rop, and the attribute is passed through to the chain to make it down to the ffmpeg node, where it can be called with `@audio_path`.
Edited by mestela - May 4, 2021 16:39:32

Attachments:
tops_combine_flipbook_and_audio.hip (374.5 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
164 posts
Joined: Feb. 2014
Offline
Thanks again Matt,
It almost works!

It's made me a movie of each frame with the audio on...

Attachments:
Screenshot 2021-05-05 at 11.01.44.jpg (480.8 KB)

http://simonfarussell.com [simonfarussell.com]
User Avatar
Member
1745 posts
Joined: May 2006
Offline
Ha, that's not what you wanted?

Hmm... Not sure what's happened there, esp in that we're both on the same platform. There's a few different ways to set this up, I can have a look tonight.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
164 posts
Joined: Feb. 2014
Offline
Could it be because I'm using 18.0.566?
I'm getting a bunch of unrecognised PDG parameters when I open your file.

Attachments:
Screenshot 2021-05-05 at 13.30.16.jpg (513.8 KB)

http://simonfarussell.com [simonfarussell.com]
User Avatar
Member
1745 posts
Joined: May 2006
Offline
Ah probably? I'm on 18.5.515.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
385 posts
Joined: July 2018
Offline
mestela
Hey Simon, figured I'd post the answer here too in case others get stuck.

I've attached an example using tops. The workflow is:

-define a path to save the audio to, store it as an attribute
-fetch a chop rop to render the audio to that location (setting the path with tops attrs, ie @audio_path)
-render the flipbook
-render a mp4, using a modified ffmpeg command string to add an extra input, -i @audio_path

Fetching the chops rop needs some minor tweaks. A tops fetch expects to keep track of the rop you link to, if it can't it generates warnings. The slight tweaks on the fetch are so that it understands which parameter on the chops rop is used for output.

The main thing is to keep track of where the audio lives, so the filename for the wav can be sent to ffmpeg. I found it was easiest just to define it within tops as an attribute. That way it can be sent over to the chops rop, and the attribute is passed through to the chain to make it down to the ffmpeg node, where it can be called with `@audio_path`.

Does this work with random frame ranges? trimming the audio to fit the frame range
  • Quick Links