[Libav-user] Creating Panned MP3 Clips

Terry Corbet tcorbet at ix.netcom.com
Sun Jan 1 08:09:31 EET 2023


I have recently discovered how to use the Audacity Envelope Tool to turn 
a standard stereo MP3 file into a modified one in which throughout the 
entire duration of the clip the apparent source of the sounds will 
traverse from left to right.  While I could use that workflow to 
manually perform the same transformation on multiple files, for my own 
use as well as to help other family members [who generally have limited 
computer skills] I want to automate that workflow.

Over the past four days I have played as much catch-up on the many 
topics and toolkits which appear might permit me to engineer a software 
solution to this requirement.  As a newbie, I probably will not 
correctly summarize what I believe to be the possible tools and 
approaches, so please forgive any misuse to the correct terminology.  I 
hope/believe that I might be able to state my concepts/questions in a 
manner which will be most considerate of the time of those who 
participate in this mailing list and most quickly help me move closer to 
a good approach to the challenge.

01.  I have managed to download the libraries which are used for the 
maintenance of the ffmpeg, ffprobe and ffplay triumvirate of tools.

02.  I have managed to successfully build some sample C programs [taken 
from the doc\examples sub-directory and other miscellaneous snippets 
found by following the wonderful links from your Wiki] using the 
CodeBlocks IDE framework.

03.  I have squirreled my way through the parts of the Doxygen 
documentation which seem like they would be most apropos.

What I did not discover was any functions or examples of what I assumed 
I would be needing to do, which essential would be to process the audio 
frames of the FrontLeft [FL]  and FrontRight [FR] channels of coming out 
of a stream of packets.  That caused me to think that perhaps I would 
find examples of that processing by searching the Audacity sources to 
learn when and how they use the ffmpeg libraries.  And somewhere between 
the Audacity and FFmpeg sites I stumbled upon some sources and some 
documentation concerning what I suppose are two reasonable libraries 
devoted to "resampling" -- soxr and swr.

It was about at that point that I concluded that my modification of the 
sampled frames probably does not fall within the ambit of what is meant 
by resampling at all and that led to an investigation of what Nyquist 
was all about.  Wow, what a guy Mr. Dannenberg must be.  The 2007 
Nyquist Reference Manual is a jaw-dropping read.

I think that is enough background/context.  Here's were I would 
appreciate any suggestions:

A.  Would it be possible to accomplish the steps necessary to achieve 
the desired result just using ffmpeg.exe?  I imagine that, using the 
command line tool and an appropriate shell scripting language, it might 
be necessary to make multiple passes of the original .mp3 file and/or 
the two separate channels.  I am not concerned about that loss of 
throughput; it will always be far faster than any manual procedure.

B.  Nonetheless, there are some advantages that would accrue from 
accomplishing the work entirely in an application .exe with a little GUI 
glitter to help the user be able to attempt some trial-and-error 
[preview] with slight changes in some of the parameters of the task 
depending upon the nature of the audio content and the manner in which 
the user will eventually play the output on different devices in 
different environments.  Since I will not have the capabilities for 
building an Envelope in the manner that Nyquist [Lisp] accomplishes 
that, can anyone point me to any sample code doing that in C with the 
eight ffmpeg .dll libraries?

C.  Or -- and I appreciate that it is not fair to ask this of this mail 
group -- but I would appreciate any experience/advice as to whether the 
solution really ought to be accomplished by some scripting and/or macro 
facilities wrapped around Audacity?

Thank you so much for the fantastic capabilities you have provided with 
the entire FFmpeg effort and for your patience in reading through my 
questions as the bell is about to strike on the New Year.



More information about the Libav-user mailing list