TOPs ffmpeg audio
2250 10 1- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
- tamte
- Member
- 8832 posts
- Joined: July 2007
- Online
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
tried some commands i found here
How to add a new audio (not mixing) into a video using ffmpeg? [stackoverflow.com]
specifically tried these :
ffmpeg -i C:/MYPATH/video.mkv -i C:/MYPATH/audio.mp3 -map 0 -map 1:a -c copy -shortest C:/MYPATH/video.mkv
ffmpeg -i C:/MYPATH/video.mkv -i C:/MYPATH/audio.mp3 -map 0:0 -map 1:0 -c copy -shortest C:/MYPATH/video.mkv
But nothing is working for some reason. i noticed not providing an output on the actual outputfilepath parameter of the ffmpegencodevideo TOP node (because i am providing it in the custom command) the node fails. Other than that the node executes but the video still has no audio.
i tried also naming the output file differently, also didn't work.
Probably not understanding the node properly.
Any tips on how to troubleshoot this?
How to add a new audio (not mixing) into a video using ffmpeg? [stackoverflow.com]
specifically tried these :
ffmpeg -i C:/MYPATH/video.mkv -i C:/MYPATH/audio.mp3 -map 0 -map 1:a -c copy -shortest C:/MYPATH/video.mkv
ffmpeg -i C:/MYPATH/video.mkv -i C:/MYPATH/audio.mp3 -map 0:0 -map 1:0 -c copy -shortest C:/MYPATH/video.mkv
But nothing is working for some reason. i noticed not providing an output on the actual outputfilepath parameter of the ffmpegencodevideo TOP node (because i am providing it in the custom command) the node fails. Other than that the node executes but the video still has no audio.
i tried also naming the output file differently, also didn't work.
Probably not understanding the node properly.
Any tips on how to troubleshoot this?
Edited by papsphilip - Feb. 26, 2023 13:24:30
- tamte
- Member
- 8832 posts
- Joined: July 2007
- Online
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
tested it in the command line.
needed a few changes to work
ffmpeg -i "C:/MYPATH/video.mkv" -i "C:/MYPATH/audio.mp3" -map 0 -map 1:a -c copy -shortest "C:/MYPATH/output.mkv"
1)needed quotes for the paths and
2)ffmpeg couldn't overwrite the same file so i have to put a different output filename.
The above command worked great in the command line but not in TOPs, because instead of "C:/MYPATH" I use "`@pdg_output`" to get the incoming output file from a previous ffmpeg operation that creates the video from a sequence. @pdg_output was empty
had to store the @pdg_output to a string attribute in order to pass it down
needed a few changes to work
ffmpeg -i "C:/MYPATH/video.mkv" -i "C:/MYPATH/audio.mp3" -map 0 -map 1:a -c copy -shortest "C:/MYPATH/output.mkv"
1)needed quotes for the paths and
2)ffmpeg couldn't overwrite the same file so i have to put a different output filename.
The above command worked great in the command line but not in TOPs, because instead of "C:/MYPATH" I use "`@pdg_output`" to get the incoming output file from a previous ffmpeg operation that creates the video from a sequence. @pdg_output was empty
had to store the @pdg_output to a string attribute in order to pass it down
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
tpetrick
@pdg_output refers to the output of the current work item itself. If you want to use the output path produced by an upstream work item, you should use @pdg_input.
yes thank you! works. in the start it wasn't evaluating to anything probably because the upstream node wasn't cooked.
Is there a way to access @pdg_input in a python expression?
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
Yep, in a parameter that's configured to use Python for its expression language, you can use pdg.input(..) to do the same thing as @pdg_input. There's also pdg.workItem() which will return the pdg.WorkItem instance that's being used to evaluate the parameter. Those functions are described at the very top of the pdg module doc: https://www.sidefx.com/docs/houdini/tops/pdg/#input [www.sidefx.com]
Edited by tpetrick - Feb. 27, 2023 19:32:24
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
Thanks a lot for the suggestions. I am working on uploading an example file here for everyone.
Bumped into another problem though ffmpeg related. How do i trim the audio to the frame range i am exporting?
There is this command i could run before adding the audio to my flipbook
ffmpeg -i music.wav -ss 0 -t 37 musicshort.wav [stackoverflow.com]
but how do i convert my frame to seconds? i have 24 frames per second. not sure if i can give ffmpeg fraction of a second. will test though.
Any suggestions?
Bumped into another problem though ffmpeg related. How do i trim the audio to the frame range i am exporting?
There is this command i could run before adding the audio to my flipbook
ffmpeg -i music.wav -ss 0 -t 37 musicshort.wav [stackoverflow.com]
but how do i convert my frame to seconds? i have 24 frames per second. not sure if i can give ffmpeg fraction of a second. will test though.
Any suggestions?
Edited by papsphilip - March 1, 2023 07:11:39
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
-
- Quick Links