replace audio on video

Questions and answers on how to get the most out of FFAStrans
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: replace audio on video

Post by authorleon »

emcodem wrote: Thu Nov 24, 2022 8:29 am 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? :D
First of all thank you very much.

Me personally I use the A drive because I can connect the letter a with automation. I do have an external floppy drive which pops up as b:\ however that is a rare event.

I have a question regarding the location of the file at the end.

https://i.imgur.com/cKOTl9h.png

Is it possible to follow the flowchart and get the command executed to use the folder node to allocate the end produced file?

the reason I ask this is that then it's more logical and linearly structured.

Thank you
emcodem
Posts: 1652
Joined: Wed Sep 19, 2018 8:11 am

Re: replace audio on video

Post by emcodem »

You mean you want to "encode" to a temporary location like the job work directory in ffastrans cache and only when everything is done, you want to use a deliver processor to copy/move the encoded file to it's target location?
No problem. I usually just avoid using temporary locations because of the additional strain it adds to disks and network. But this is only really interesting in enterprise environments but not in local environment. In local environments when using the cache for encoded files i'd probably check the "move instead of copy" in the deliver processor to avoid the unneccessary copy.

Here the same example as before but transcoding into work_dir and then copying to target location using the deliver proc.
emcodem_replace_audio.json
(2.34 KiB) Downloaded 41 times
emcodem, wrapping since 2009 you got the rhyme?
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: replace audio on video

Post by authorleon »

Hi, is that file correct? I think it might be the same as the original one?

Please let me know if you would.

Regarding your comment, yes you are absolutely correct. I have a few local NVMEs anyway and I am not processing hundreds of videos of the thing time. :)
emcodem
Posts: 1652
Joined: Wed Sep 19, 2018 8:11 am

Re: replace audio on video

Post by emcodem »

OK i shall remember to rename files when i upload duplicates :D
emcodem_replace_audio_2.json
(3.14 KiB) Downloaded 48 times
emcodem, wrapping since 2009 you got the rhyme?
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: replace audio on video

Post by authorleon »

Absolutely brilliant.

Works perfectly.

Question, I have been looking at some of the commands. Would there be a way to fade in audio and fade out the audio.


So from what I understand from this code:

Code: Select all

-vf "fade=t=in:st=0:d=3,fade=t=out:st=10:d=5"
The audio starts at zero and fades in fully after three seconds
then after 10seconds, it fades out for a duration of five seconds.

the thing I would like to do is

1 - 0 Sec - Audio 0%
2 - 3rd Sec - Audio 100%
3 - 5sec BEFORE the end Audio 100%
4 - Last second - Audio faded down to 0.

I guess the complicated part is determining the end of the video so I imagine the video would have to be scanned first in order to determine its length?


Working code at the moment!

Code: Select all

"%s_ffmpeg%" -i "%s_original_full%" -i "%s_original_path%\%s_original_name%.mp3" -c:v copy -map 0:v:0 -map 1:a:0 -shortest -y "%s_job_work%\%s_original_name%.%s_original_ext%"
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: replace audio on video

Post by authorleon »

If anybody would like to add a watermark to the video:
please have a look at this give animation which gives you all the information.

Image

also this is a fantastic way for me to test my automated gift / upload - settings software.
ThomasM
Site Admin
Posts: 227
Joined: Wed Feb 22, 2017 6:36 am

Re: replace audio on video

Post by ThomasM »

authorleon wrote: Thu Nov 24, 2022 2:25 pm
I guess the complicated part is determining the end of the video so I imagine the video would have to be scanned first in order to determine its length?
you can determine the length in seconds by creating a user-variable. Then with the Populate-Variable-Node you can get the length in seconds rounded down to the next integer by populating your variable with this:
$roundd($jsonget("%s_info_mediainfo%","media.track[0].Duration"))
this is a nested function. The inner function reads the duration in sec.msec from MediaInfo. the outer rounds this down to the next full second.

Check the documentary for more nice functions and built-in variables!

cheers
Thomas
Post Reply