Converting and Processing Audio

Questions and answers on how to get the most out of FFAStrans
PA79
Posts: 20
Joined: Wed Feb 23, 2022 2:37 pm

Converting and Processing Audio

Post by PA79 »

Hello FFAstrans Forum - Glad to be here :-)

I nearly read all the topics which could be relevant to me but i didnt find any way for my problem.

I´m a 99% Rooky in FFAstrans (and ffmpeg) btw.
But maybe there is an solution for my project.
(running on FFAStrans 1.3)

I´m working at a local Radio Station an i like to build a Network Audio Converter for any kind of Formats and Codecs to MP3
Most we have Whatsapp Voice Messages (OGG/Opus), Broadcast MP2 or M4A that must be converted to MP3 for the Playout System
(That actually works with FFAStrans ...but)

What i have:
Watchfolder for Any Audio/Video data (Works)
Audio extraction of the A/V files in the Watchfolder to MP3 (Works)
Deliver extracted MP3 to Output-Folder (Works)

My Goal:
The (extracted) Audio should be processed (like Equalizer, Compressor, Limiter)
This processed file should be saved in my Delivery Folder.

Is there a Solution in FFAStrans or with coustum ffmpeg to process my audio in FFAStrans?
if there is a Solution, how would you code this?
I tried a lot with Costum ffmpeg but nothing works - or I´m to stupid :-)

Wish you a nice day
PA
Attachments
Possible?
Possible?
FFAStrans.jpg (212.91 KiB) Viewed 8024 times
Last edited by PA79 on Fri Mar 18, 2022 4:13 pm, edited 2 times in total.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

Hey PA, damn you ruined our welcome message by saying you're glad to be here up in front ;-)

I fear we need to turn a non-noob of you when you want to do that. Especially equalizing takes lots of parameters, where would you take them from? Would they be the same for each and every source file?

So, nothing really built in for you, that means we can either use Avisynth or ffmpeg.
I assume you might be a noob in ffastrans but you are good in audio processing already (most likely better than i am).

Before we decide which route to go, avisynth or ffmpeg, please check out some of their filters and let me know which one you feel most comfortable with, the ffmpeg or the avisynth ones:

ffmpeg Equalizer:
http://ffmpeg.org/ffmpeg-filters.html#t ... cequalizer

ffmpeg Compressor:
http://ffmpeg.org/ffmpeg-filters.html#toc-acompressor


Avisynth Equalizer:
http://avisynth.nl/index.php/SuperEQ

Avisynth Compressor(and others):
http://avisynth.nl/index.php/Soxfilter
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 »

Hey emcodem - sry about the ruined Welcome Message :-/

That would be great if i become a semi-pro with that application.
This is a very powerfull Solution for A/V Workers.

Its everytime the same processing for the Audio.
Dont worry about the parameter of each Processing.
I´m familiar with audio Processing.
Doenst matter if i push 5 or 10 db at a specific Frequency - here I would "Set - listen - adjust - listen - adjust etc. until i get a good result.
Thats my 1% non-noob :-)

My Problem is how to Code this in a Cosutom ffmpeg (or Avisynth)
Thats my 99% noob

I´ve allready take a look at Avisynth and ffmpeg filters.
I think ffmpeg got the more powerful filters an a bigger selection of different Filters.

So i would say ffmpeg could be my way to go.

Thanky you very much for your support
PA
Attachments
FFAStrans_2.jpg
FFAStrans_2.jpg (176.18 KiB) Viewed 8004 times
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

aye PA,

ok, so while trying some stuff for you i recognized that we most likely have some bugs regarding audio only in the A/V decoder and in the Loudness analyzer nodes but those would be mostly not helpful for you.
Anyway, so you decided for the ffmpeg route, congrats on that, i would have chosen the same.so let's start.

1) forget about the custom ffmpeg node, it is more or less the same as a custom commandline but it brings additional confusion with it. So we take the commandline processor.

2) the only thing that the custom ffmpeg node does is adding the "path to ffmpeg", "input file" and "output file" in a magical way, we can easily do that using a cmd processor, and we are even more flexible when doing so.

3) when working the way i suggest, you should be well aware about variables in general but have a special note about the %s_source% variable as explained here https://ffastrans.com/wiki/doku.php?id= ... _variables

4) ffmpeg filter basics:

Code: Select all

-af "adynamicequalizer=threshold=50:tfrequency=10"
This is some basic audio filter instruction that we need to insert in an ffmpeg commandline "somewhere between the input and output file name". Usually every ffmpeg command starts with %path_to_ffmpeg% -i %sourcefile% and usually it ends with just the output filename and extension. ffmpeg will try to detect what we want to do by just looking at the extension (of course we can override anything by adding corresponding lines to the command)


Note the syntax: -af(space) says audio filter (you know that already) but now we can insert one or many audio filters. Above you only see one filter, if you had multiple, you would separate using the "," character. Also notice the "=" and ":" above. Basically we say
  • "FILTERNAME=OPTION=VALUE:ANOTHEROPTION=VALUE"
if we had multiple filters it would look like
  • "FILTERNAME=OPTION=VALUE:ANOTHEROPTION=VALUE,ANOTHERFILTERNAME=OPTION=VALUE:ANOTHEROPTION=VALUE"
Usually, when working with ffmpeg, we first play with ffmpeg on the commandline and only when we get the desired result, we take it into automation. This means... you know what ffastrans can do for you: it can extract the audio of virtually any format and store as mp3 or wav or whatever. So when working with ffmpeg, you can take always the same input file format, it is the one that ffastrans would generate for you.

Anyway, so on commandline, you would do this:

Code: Select all

ffmpeg -i C:\temp\loud.wav -af alimiter=level_in=1:level_out=2 -y c:\temp\out.wav

In a commandline processor of ffastrans the same would translate to this:

Code: Select all

"%s_ffmpeg%" -i "%s_source%" -af alimiter=level_in=1:level_out=2 -c:a pcm_s32le -y "c:\temp\%s_original_name%_%i_hour%_%i_min%_%i_sec%_%i_msec%.wav"
Above is exactly what the attached workflow does. The workflow shows how to use ffastrans for extracting audios from any source file and then go on with ffmpeg custom command.
Note that the final output file will be written to c:\temp, you can find and change c:\temp in the commandline processor.
emcodem_ffmpeg_audio_filters.json
(2.72 KiB) Downloaded 315 times
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 »

emcodem...it works!!!

for testing I tried a compressor (Compand) and changed the Output Format to MP3 CBR 320k.

Is it right that "-vn" is used to discard any of possible Video information?

Just for my Interest. for what stands the "-y" in your Command?

the used values are just for my testing and will further developed for my case.
So my (temp) Command looks like this:

Code: Select all

"%s_ffmpeg%" -i "%s_source%" -vn -af compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0 -b:a 320k -codec:a libmp3lame -y "TEMP-OUTPUT-PATH\%s_original_name%_%i_hour%_%i_min%_%i_sec%_%i_msec%.mp3"
There are not much (i dont know even one) Solutions on the market that can handle this job automated.

When i finished my Project I will make my commands availible for the Community in form of Presets.

Like:
soft Compress, Hard Compress, De-nois, Autmatic Level Control, etc.

I think a lot of Radio Stations would be very happy with this Solution.
So nobody have to go to the Audio engineering department and asks for converting or processing an Interview or something like that. 8-)

That´s so cool!

An idea for the future if that is possible:
there are a lot of (free and good) VST Audio Plugins on the market.
If there is a way to implement an VST Host in FFASTrans, that would be next Level for automated Audio Processing.

If you like you can take a look at the Audio Plugin called "LoudMax" by Thomas Mundt.
This is my "SetAndForget" Master-Channel Limiter on every Video Projects in Premiere Pro.

This PlugIn exists as LADSPA too but i think ffmpeg can handle this only in a Linux Enviorment?

Sorry for the bunch of questions :lol:

If you have some trouble with Audio editing let me know.
I´ll try to help whereever i can

Thank you very very much.
PA
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

PA79 wrote: Thu Feb 24, 2022 3:14 pm Is it right that "-vn" is used to discard any of possible Video information?
Just for my Interest. for what stands the "-y" in your Command?
yes about -vn but it's not needed when your output file has .mp3 or wav extension. If you output only audio, ffmpeg will discard video automatically.
-y is for automatically overwrite the output file, we add this typically in any automated ffmpeg execution because if we do not add it, ffmpeg could potentially hang forever, waiting for a userinput to press "y" for allowing overwriting the output file.
PA79 wrote: Thu Feb 24, 2022 3:14 pm

Code: Select all

"%s_ffmpeg%" -i "%s_source%" -vn -af compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0 -b:a 320k -codec:a libmp3lame -y "TEMP-OUTPUT-PATH\%s_original_name%_%i_hour%_%i_min%_%i_sec%_%i_msec%.mp3"
in that case, you don't specify the full location of OUTPUT-PATH, so it will go to some temp directory i guess. C:\OUTPUT-PATH would make it more clear. (or \\server\share\OUTPUTPATH)
PA79 wrote: Thu Feb 24, 2022 3:14 pm There are not much (i dont know even one) Solutions on the market that can handle this job automated.
Well there is a ton of solutions but most of them target consumer market instead of professional. Only we are so stupid to provide free software to professionals hehe

PA79 wrote: Thu Feb 24, 2022 3:14 pm An idea for the future if that is possible:
there are a lot of (free and good) VST Audio Plugins on the market.
If there is a way to implement an VST Host in FFASTrans, that would be next Level for automated Audio Processing.
If you like you can take a look at the Audio Plugin called "LoudMax" by Thomas Mundt.
This is my "SetAndForget" Master-Channel Limiter on every Video Projects in Premiere Pro.
This PlugIn exists as LADSPA too but i think ffmpeg can handle this only in a Linux Enviorment?
It would be kind of fun to implement support for this but it would need to be done partly in form of an ffmpeg audio filter and partly in ffastrans
or a standalone tool (showing the plugin gui to create presets) - well maybe one can use VST to create presets and just utilize them in ffmpeg if there was a corresponding filter available?

Also, looking at the license, i am not really sure if it's really legal to reverse engineer their stuff and write a custom plugin host:

Code: Select all


This Software Development Kit is licensed under the terms of the Steinberg VST3 License,
or alternatively under the terms of the General Public License (GPL) Version 3.
You may use the Software Development Kit according to either of these licenses as it is
most appropriate for your project on a case-by-case basis (commercial or not).

a) Proprietary Steinberg VST3 License
The Software Development Kit may not be distributed in parts or its entirety
without prior written agreement by Steinberg Media Technologies GmbH.
The SDK must not be used to re-engineer or manipulate any technology used
in any Steinberg or Third-party application or software module,
unless permitted by law.
PA79 wrote: Thu Feb 24, 2022 3:14 pm If you have some trouble with Audio editing let me know.
I´ll try to help whereever i can
Well maybe you are our new audio guy? :D
It would be nice to see you hanging around here and trying different stuff with ffastrans
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 »

Short Update.

I made all off my Processing - and it sounds pretty good.
Got five Processing Channels. (See Pic)

When i made my final Processing to all of my Channles i will publish all of my processing Commands and explain what i did and why.

Now i will install ffastrans and ffmpeg on a Server (Dell R3409 - running with Win 10 Pro) so i can outsource the hardware to our Server Room.
Win 10 beacuse i want to install Microsoft Teams on it. So i can send an Audio via Smartphone (MS Teams App) in a Team on MS Teams.
MS Teams saves this Audiofile in a MS Onedrive Folder which can be monitored by a ffastrans watchfolder.

This is very usefull for our journalists when they are mobile reporting 8-)
They sends the Audio (interview) very raw and ffastrans make a broadcastable audio.
in that case, you don't specify the full location of OUTPUT-PATH, so it will go to some temp directory i guess. C:\OUTPUT-PATH would make it more clear. (or \\server\share\OUTPUTPATH)
I "censored" the original Path because idk if i was allowed to publish our Network Adresses. originally there was a valid Path :-)
Attachments
FFAStrans_Project.png
FFAStrans_Project.png (139.13 KiB) Viewed 7822 times
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

Nice, thanks for the update.
Its just a shame that the Onedrive stuff cannot be used when running as a background service :?
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 »

So theese are my Processing Commands.
Not the holy grail but they work for me pretty good :-)
many thanks to emcodem. Without you i could not handle this project.

I use thees Presets for Voice

This is my Raw Voice recording. At the second step i putted a WhiteNoise (Flat Freqency Response in each Processing Folder so you can se how the Processors affect the Frequency Response.

Original: No Processing
Image
Clean White Noise whithout Processing
Image

"Just make MP3" with suffix "MP3-Only" and time stamp.
(Converts any Audio or Videofile to a 320 Kbits MP3)

Code: Select all

"%s_ffmpeg%" -i "%s_source%" -vn -af aresample=out_sample_fmt=s16 -b:a 320k -codec:a libmp3lame -y "C:\OUTPUT-PATH%s_original_name%_MP3-Only%i_hour%_%i_min%_%i_sec%.mp3"
(No pics needed beacuse it just Convert the Format/Codec. no change to Gain and Freqency Response)


Medium Processing:
- Attenuate the over all gain to -10db
- Highpass Filter at 80Hz to remove "rumble" sound.
- Exciter adds Harmonic Distortion, 3 Harmonics with a Drive of 2. Drive means how much Gain of the Harmonics are added to the signal. Frequency apex is set to 6500Hz. The Exciter starts working at 6500Hz. So your Voice become more "shiny/crystal". The Exciter adds Freqencies to lossy Formats
- Equalizer boost at 100Hz with +4db with a Q-width of 1. Adds more Bass to your Voice (Braodcast typically)
- Set Limiter to reduce and limit the dynamic of the Signal (makes the gain more even)
- Dynaudionorm to bring up the the gain to a broadcastable Gain (Makes it loud)

Code: Select all

"%s_ffmpeg%" -i "%s_source%" -vn -filter:a "volume=-10dB",highpass=f=80,aexciter=amount=3:drive=2:freq=6500,equalizer=f=100:t=q:w=1:g=4,alimiter=level_in=3:level_out=1:limit=0.9:level=enable,dynaudnorm=f=50:g=150:b=1 -b:a 320k -codec:a libmp3lame -y "C:\OUTPUT-PATH%s_original_name%_Medium_Processing%i_hour%_%i_min%_%i_sec%.mp3"
Medium Processing:
Image
Image



Strong Processing (Excites the Signal more than the "Medium Preset" and reduce the Dynamic more. Use this if you have very quiet and very loud Parts in your Voice recording)
- Attenuate the over all gain to -10db
- Highpass Filter at 80Hz to remove "rumble" sound.
- Exciter adds Harmonic Distortion, 4 Harmonics with a Drive of 6. Drive means how much Gain of the Harmonics are added to the signal. Frequency apex is set to 6500Hz. The Exciter starts working at 6500Hz. So your Voice become more "shiny/crystal". The Exciter adds Freqencies to lossy Formats
- Equalizer boost at 100Hz with +4db with a Q-width of 1. Adds more Bass to your Voice (Braodcast typically)
- Set Limiter to reduce and limit the dynamic of the Signal (makes the gain more even)
- Dynaudionorm to bring up the the gain to a broadcastable Gain (Makes it loud)

Code: Select all

%s_ffmpeg%" -i "%s_source%" -vn -filter:a "volume=-10dB",highpass=f=80,aexciter=amount=4:drive=6:freq=6500,equalizer=f=100:t=q:w=1:g=4,alimiter=level_in=5:level_out=1:limit=0.9:level=enable,dynaudnorm=f=50:g=150:b=1 -b:a 320k -codec:a libmp3lame -y "C:\OUTPUT-PATH%s_original_name%_Strong_Processing%i_hour%_%i_min%_%i_sec%.mp3"
Strong Processing:
Image
Image



Whatsapp Voice Messages Exciter (Spoken in the Smartphone Mic and send via Whatsapp App)
- Attenuate the over all gain to -10db
- Highpass Filter at 80Hz to remove "rumble" sound.
- Exciter adds Harmonic Distortion, 4 Harmonics with a Drive of 6. Drive means how much Gain of the Harmonics are added to the signal. Frequency apex is set to 6500Hz. The Exciter starts working at 6500Hz. So your Voice become more "shiny/crystal". The Exciter adds Freqencies to lossy Formats
- Equalizer boost at 100Hz with +8db with a Q-width of 1. Adds more Bass to your Voice (Braodcast typically)
- Set Limiter to reduce and limit the dynamic of the Signal (makes the gain more even)
- Dynaudionorm to bring up the the gain to a broadcastable Gain (Makes it loud)

Code: Select all

"%s_ffmpeg%" -i "%s_source%" -vn -filter:a "volume=-10dB",highpass=f=80,aexciter=amount=4:drive=6:freq=6500,equalizer=f=100:t=q:w=1:g=8,alimiter=level_in=3:level_out=1:limit=0.9:level=enable,dynaudnorm=f=50:g=150:b=1 -b:a 320k -codec:a libmp3lame -y "C:\OUTPUT-PATH%s_original_name%_Whatsapp_Exciter%i_hour%_%i_min%_%i_sec%.mp3"
Whatsapp Voice Messages Exciter
Image
Image

Again: Thank you very much emcodem for your help.
I am excited what I can do next 8-)

Edit:
Text to Speech Preset is still in Beta...
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Converting and Processing Audio

Post by emcodem »

Fantastic, there don't seem to be too much examples out there about practical use of those filters. Thanks a lot for that!

Regarding VST Plugins, i accidently found this, https://github.com/teragonaudio/MrsWats ... /tag/0.9.8
This appears to me like exactly whats needed in order to utilize VST Plugins from ffastrans. Are you aware about that and can it be used?
emcodem, wrapping since 2009 you got the rhyme?
Post Reply