Converting and Processing Audio

Questions and answers on how to get the most out of FFAStrans
taner
Posts: 204
Joined: Sun Jun 19, 2016 6:36 pm

Re: Converting and Processing Audio

Post by taner »

emcodem wrote: Tue May 16, 2023 7:03 am Is there a way to e.g. filter the voices nicely and clean from a whole movie?
You can try htdemucs (v4).
Pretty good results.
I'm not sure but I think they are also providing a gui both for mac and windows if necessary.
https://github.com/facebookresearch/demucs.

Apart from that Blackmagic has implemented Voice Isolation in DaVinci Resolve 18.
Very good results.
And with that I mean: very very good.
If you are looking for a standalone solution which does not need to be integrated into other apps or such else than this should satisfy your needs.

Best
Taner
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

big thanks @taner
already integrated demucs now :D Is there any way to utilize Resolve's capabilities in fully automated workflows? ..i always thought of it as a tool dedicated for manual usage only...

Thanks!
emcodem, wrapping since 2009 you got the rhyme?
taner
Posts: 204
Joined: Sun Jun 19, 2016 6:36 pm

Re: Converting and Processing Audio

Post by taner »

Hi emcodem,

this is all i know about.
Maybe i could be a starting point.
https://deric.github.io/DaVinciResolve-API-Docs/

Best
Taner
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

Hey @taner well thats good info, thanks a bunch!
Unfortunately it looks like BMD wants to expose the "script from outside" feature only for buyers of the Pro (studio) Version. Otherwise i would have probably developed some ffastrans modules to remote control a little this and that :D
But honestly, the whole thing is not designed to be a "run in background" solution - just being able to script the ui actions doesnt mean that it's a good idea to attempt to run it headless as windows service or such and build automations around it. But for a little here and then use, it would of course be a very nice solultion.
emcodem, wrapping since 2009 you got the rhyme?
PA79
Posts: 20
Joined: Wed Feb 23, 2022 2:37 pm

Re: Converting and Processing Audio

Post by PA79 »

Hi guys

unfortunately I had to put the project on hold for a short time. But now I am back in full swing. For the solution with the web interface, I unfortunately still lack the knowledge for the implementation. Therefore I would like to work as usual with a network folder structure. But in the future I would like to change the whole structure to the web interface

The most complicated thing was to generate the ffmpeg command to mix 5 audio files depending on the length of the (two) moderations and to provide a pleasant transition so that the audio files are not "hard" cut to each other.

ffmpeg command (works) :-)

Code: Select all

ffmpeg -i intro.wav -i mod1.wav -i bumper.wav -i mod2.wav -i outro.wav -filter_complex "[1:a]adelay=9800|9800[mod1_with_delay]; [0:a][mod1_with_delay]amix=inputs=2:duration=shortest[intro_mod1_mix]; [3:a]adelay=2800|2800[mod2_with_delay]; [2:a][mod2_with_delay]amix=inputs=2:duration=shortest[bumper_mod2_mix]; [intro_mod1_mix][bumper_mod2_mix]acrossfade=d=0.3:o=1:c1=ipar:c2=ipar[crossfaded]; [3:a]atrim=0:-1[mod2_trimmed]; [crossfaded][mod2_trimmed]concat=n=2:v=0:a=1[pre_outro_combo]; [pre_outro_combo][4:a]acrossfade=d=0.3:o=1:c1=ipar:c2=ipar[final_output]" -map "[final_output]" -f wav -acodec pcm_s16le -ar 44100 result.wav
My command for the Command Excecuter Node in ffastrans would look like this (I hope I have not made a mistake)

Code: Select all

"%s_ffmpeg%" -i "\\10.10.10.213\Daten\Dokumente\AUDIO TRANSCODER\MODULE TEST\ELEMENTE\intro.wav" -i "%s_job_work%\%s_original_name%_MOD1.wav" -i "\\10.10.10.213\Daten\Dokumente\AUDIO TRANSCODER\MODULE TEST\ELEMENTE\bumper.wav" -i "%s_job_work%\%s_original_name%_MOD2.wav" -i "\\10.10.10.213\Daten\Dokumente\AUDIO TRANSCODER\MODULE TEST\ELEMENTE\outro.wav" -filter_complex "[1:a]adelay=9800|9800[mod1_with_delay]; [0:a][mod1_with_delay]amix=inputs=2:duration=shortest[intro_mod1_mix]; [3:a]adelay=2800|2800[mod2_with_delay]; [2:a][mod2_with_delay]amix=inputs=2:duration=shortest[bumper_mod2_mix]; [intro_mod1_mix][bumper_mod2_mix]acrossfade=d=0.3:o=1:c1=ipar:c2=ipar[crossfaded]; [3:a]atrim=0:-1[mod2_trimmed]; [crossfaded][mod2_trimmed]concat=n=2:v=0:a=1[pre_outro_combo]; [pre_outro_combo][4:a]acrossfade=d=0.3:o=1:c1=ipar:c2=ipar[final_output]" -map "[final_output]" -f wav -acodec pcm_s16le -ar 44100 "%s_job_work%\%s_original_name%_MODUL.wav"
Now to my workflow idea: (biggest Problem)
Two watchfolders (Mod1 and Mod2) each followed by the node "audio extraction" with name extension "%s_original_name%_MOD1.wav" and "%s_original_name%_MOD2.wav".
In my idea there should be a "Hold" node, which waits for the respective file until it is in the cache and then forwards the files to the above ffmpeg command.

Like this?

Image

I have already tried many variants of how ffastrans correctly fetches the audio stored in the watchfolder for further processing. But unfortunately all the ways I tried were a dead end.

If the ffmpeg command in ffastrans should not be correct it doesn't matter. with ffmpeg I have become quite good by now (and thanks to ChatGPT). The native ffmpeg command works fine.

I hope someone has a super mega great idea.

Wish you guys a nice Day!
PA
Attachments
VST Host Test_emcodem_new.json
(67.25 KiB) Downloaded 45 times
Workflow idea.PNG
Workflow idea.PNG (17.9 KiB) Viewed 2203 times
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

Aye PA,
without looking into the filter details of your ffmpeg cmd, the ffastrans version looks fine on quick peek. It might just be a good idea to use a STATIC variable instead of hardcoding UNC paths directly in processors but thats kind of an advanced topic.

Regarding your workflow, you cannot have 2 Watchfolders in one job, they would end up as 2 standalone jobs, one not knowing anything about the other. Here is why (look at workflows_equal.png picture): https://ffastrans.com/frm/forum/viewtop ... =849#p3565
You must start your workflow using 1 watchfolder and it is best to trigger jobs only when the LAST file arrived. So your user needs to throw to files into the folder, one called *_MOD1.mp4 *_MOD2.mp4 - in this case you would set to watch only for *_MOD2.mp4 (if that one is expected to be coming in after *_MOD1.mp4.

As it is not simple to merge branches after a split, it is best if you do all processing in serial, it goes like this:

watchfolder -> Audio extract2 -> Populate1 -> audio extract1 -> merge

The Populate1 node is the key, you need to save the current s_source and set s_source to the the other source file. E.g.
%s_mod_2% = %s_source%
%s_source% = "%s_job_work%\%s_original_name%_MOD1.wav"

You need to understand what value s_source has at any point in the workflow. After each Audio Extract processor, s_source points to the internally generated .wav file in the "work_dir". So after the second Audio Extraction, s_source points to the second generated wav file in the job_work_dir.

Last, in the ffmpeg command you posted, you would basically replace
"%s_job_work%\%s_original_name%_MOD1.wav" by "%s_source%"
and
"%s_job_work%\%s_original_name%_MOD2.wav" by "%s_mod_2%"

More infos about s_source:
https://ffastrans.com/frm/forum/viewtopic.php?f=5&t=849
https://www.ffastrans.com/wiki/doku.php ... _variables
emcodem, wrapping since 2009 you got the rhyme?
PA79
Posts: 20
Joined: Wed Feb 23, 2022 2:37 pm

Re: Converting and Processing Audio

Post by PA79 »

I tried for a really long time to get it solved with the variables. But I couldn't get it to work. Now I have solved it with a Python script that copies the audio extraction files back and forth wildly in the .ffastrans_work_root. but in the end it works. 8-)
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

Code: Select all

 copies the audio extraction files back and forth wildly
That's how i usually solve my troubles ;)
emcodem, wrapping since 2009 you got the rhyme?
Post Reply