Page 1 of 2
replace audio on video
Posted: Thu Nov 17, 2022 7:49 pm
by authorleon
hello. I just wanted to know if it were possible to replace the audio on a video clip.
Of course I would provide the file path to the audio file.
I'm just asking a general question here because I'm not quite sure if there is an existing module that allows you to do that, or if it's custom?
Thanks
Re: replace audio on video
Posted: Thu Nov 17, 2022 11:14 pm
by FranceBB
The good news is that you can totally do that.

The question is: do you just want to remux the video with a completely different audio OR do you want to re-encode the video and the new audio and create a new file with the new video and audio?
The reason why I'm asking is that depending on your answer it's gonna be either a command executor (remux) OR a Custom Avisynth Script (re-encode).

Re: replace audio on video
Posted: Sat Nov 19, 2022 8:24 pm
by authorleon
Hello FranceBB.
Technically I need both however I think it's best to focus on the one that I need the most. okay so I just looked up REMUX and effectively it is just replacing the audio but keeping the same video if I'm correct?
Effectively, I would like to re-encode the video with a new audio file. In this case an MP3 with some music.
Please note. If the MP3 is 10 minutes long for example, and the video is only one minute long. Then of course it should encode one-minute video with one minute of audio.
Thank you
Re: replace audio on video
Posted: Mon Nov 21, 2022 12:15 pm
by ThomasM
Hi authorleon,
Code: Select all
ffmpeg -i "%s_original_full%" -i "PathOfAudio.Here" -c:v copy -map 0:v:0 -map 1:a:0 -shortest "NewPathAndNameOfOutputFile.Here"
in a Command Executor coul do the trick.
Just an idea...
Thomas
Re: replace audio on video
Posted: Wed Nov 23, 2022 1:34 pm
by authorleon
Hi Thomas,
I gave it a got. But it did not work:
Code: Select all
ffmpeg -i "%s_original_full%" -i "A:\FFAStrans_Video_Processing\00_Test\audio.mp3" -c:v copy -map 0:v:0 -map 1:a:0 -shortest "A:\FFAStrans_Video_Processing\00_Test\out\%s_original_full%"
https://i.imgur.com/QATALnA.png
I have played around but I cannot get it to work.
ThomasM wrote: ↑Mon Nov 21, 2022 12:15 pm
Hi authorleon,
Code: Select all
ffmpeg -i "%s_original_full%" -i "PathOfAudio.Here" -c:v copy -map 0:v:0 -map 1:a:0 -shortest "NewPathAndNameOfOutputFile.Here"
in a Command Executor coul do the trick.
Just an idea...
Thomas
Re: replace audio on video
Posted: Wed Nov 23, 2022 2:48 pm
by emcodem
authorleon wrote: ↑Wed Nov 23, 2022 1:34 pm
Code: Select all
ffmpeg -i "%s_original_full%" -i "A:\FFAStrans_Video_Processing\00_Test\audio.mp3" -c:v copy -map 0:v:0 -map 1:a:0 -shortest "A:\FFAStrans_Video_Processing\00_Test\out\%s_original_full%"
Thoma's concept is correct, i suspect there is some issue with your command line, e.g. you use "ffmpeg" at start, which implies that ffmpeg.exe is available somewhere in the PATH of your System. Otherwise you'd need to use "%s_ffmpeg%", this points to the ffmpeg location that is shipped with ffastrans.
Example implementation here:
Btw, i did't know that the A: drive is already free to use, isn't there still lots of legacy software having troubles with that?

Re: replace audio on video
Posted: Wed Nov 23, 2022 2:53 pm
by authorleon
thank you. Let me get back to you and find out what thee problem is
Re: replace audio on video
Posted: Wed Nov 23, 2022 4:29 pm
by authorleon
just a quick question.
If the video file is "test.mp4".
The mp3 file should be "test.mp4.mp3"
" "%s_original_path%\%s_original_name%_newaudio%s_original_ext%" "
it is just that I've tried many different variations and it still waiting. I have also put the MP3 in the same folder as the video file.
Re: replace audio on video
Posted: Thu Nov 24, 2022 7:40 am
by ThomasM
Yeah, I got ffmpeg.exe in PATH for using it quick and got it handy on CMD.
@authorleon, try your Command-Executor-Node Codes in the windows-commandline. That is faster and easier to debug. If that works, copy the line to your Node. then, one after one, try to exchange the full paths with variables.
In your case, I assume the .mp4-File will be picked up by a Monitor-Node - right? so you got [example on D:\] "D:\MyVideosAndReplaceAudioFiles\test.mp4" in built-in File-Variable %s_original_full% and "D:\MyVideosAndReplaceAudioFiles" in built-in File-Variable %s_original_path%.
To add the audio-file "test.mp4.mp3" the path would be "D:\MyVideosAndReplaceAudioFiles\test.mp4.mp3" - right?
This would be the same as ""%s_original_path%\%s_original_name%.%s_original_ext%.mp3"
@emcodem: I always use the A:\-Drive for my 5 1/4"-Floppy-Disk. Still working with WordStar 7.0 under DOS 6.22 (just updated from 12" FloppyDisk!)
regards,
Thomas
Re: replace audio on video
Posted: Thu Nov 24, 2022 8:29 am
by emcodem
Sorry there is a copy/paste issue in the workflow.
The hold node should wait for the file
"%s_original_full%.mp3"
that resolves to test.mp4.mp3 then in reality if test.mp4 was the video that you submitted.
@ThomasM
you got a "working" floppy drive?
