[Libav-user] Creating Panned MP3 Clips

Terry Corbet tcorbet at ix.netcom.com
Tue Jan 3 23:14:54 EET 2023

>         Nope, your software can't do it.
>         Use ffmpeg's stereotools filter with asendcmd. Supports
>         runtime changing of parameters.
>     Thanks for suggestion! Yes, fully automatic panning on variable
>     length clips probably not easy to automate in CinGG
>     (even in bath mode). But I opened said filter (stereotools) and
>     apparently I can set cingg plugin keyframes for its internal
>     parameters ..
>     I do not think we have timeline support for ff filters, but does
>     this system offer any advantage in our case?
>  Timeline and runtime changeable parameters are different things, they 
> are not same.
> Timeline just disables/bypass processing in certain time frames. While 
> runtime parameters can be changed at any time frame.
> But parameters can also be slowly interpolated so that no artifacts 
> appear upon changes.

The attached Windows bat file with comments represents the present state 
of my solution to the requirements.  While obtaining the mid-point of 
the input audio file via a string of unix commands is workable, I had 
really hoped that there would be some global variable or macro providing 
the duration.  I have not been able to find it and having to invoke 
ffmpeg twice to get the job done is not ideal.

I am happy that you pointed me in the direction of using the ffmpeg 
executable, but as I can imagine scope creep, I am not adverse to going 
back to my attempt to write the solution as a C program if that would be 
the better way to obtain the duration(s) of the input(s).

Thank you again.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20230103/428960ce/attachment.htm>
-------------- next part --------------
@echo off

REM -loglevel warning
REM -nostats

ffmpeg.exe -hide_banner -loglevel info -y -i ali.mp3 ^
   -filter_complex ^
      "[0:a] asplit='2' [al][ar]; [al] pan='FL | c0=1.0*c0' , afade='out:st=85:d=85' [ch1]; [ar] pan='FR | c0=1.0*c1' , afade='in:st=0:d=85' [ch2]; [ch1][ch2] amerge=2" ^

REM The -filter_complex option to the ffmpeg command takes a filter graph for
REM its input. There are three semi-colon-separated filter chains in this example.
REM Further each of our filter chains is in fact just a single filter.

REM The asplit filter with an argument of 2 [which is the default, so it can be
REM left out] effectively duplicates the ali.mp3 input file. The two strings following
REM the single-quoted argument list provide identifiers for the two copies of the input.
REM Those identifiers are used for the following filters, one for each of the left and
REM right mono outputs we want to produce.

REM The pan filter is poorly named; there is no panning going on. As configured we are
REM just outputting the two streams of the stereo input unchanged. Reading the documentation
REM for the pan filter, I would never have figured out what was required.

REM Unix commands yield ali.mp3 duration of 169 seconds.
REM Midpoint = (169 / 2) = 85.
REM Fade Out Start = 85, Duration = 85.
REM Fade In Start = 0, Duration = 85.

More information about the Libav-user mailing list