[FFmpeg-devel] [PATCH 1/1] libavfilter/volume: do fade when adjusting the volume.

Gyan Doshi ffmpeg at gyani.pro
Sat Apr 26 07:52:09 EEST 2025



On 2025-04-26 12:53 am, Marton Balint wrote:
>
>
> On Thu, 24 Apr 2025, Gyan Doshi wrote:
>
>>
>>
>> On 2025-04-24 02:05 am, Marton Balint wrote:
>>>
>>>
>>>  On Wed, 23 Apr 2025, cenzhanquan2 at gmail.com wrote:
>>>
>>>>  From: zhanquan cen <cenzhanquan2 at gmail.com>
>>>>
>>>>  1. add simple fade when volume.
>>>>  2. do fade when adjust volume to maximal.
>>>>
>>>>  when to adjust volume we hope that the audio sample is smooth
>>>>  we need to calculate the gradient step between each sample based
>>>>  on the total change of the gradient (i.e. dst_volume - src_volume)
>>>>  and the number of samples (nb_samples) and apply it to the target 
>>>> sample.
>>>
>>>  I don't understand this. Why would you want any fading when you 
>>> want to
>>>  apply the audio gain uniformly over the whole duration of audio?
>> It is useful to transition into the new volume level.
>
> The afade filter (or combining volume with afade) can already support 
> such a use case, no?

afade only fades from/to 0.
And it only operates at stream boundaries, but the volume filter 
supports timeline 'enable' for mid-stream changes.

Regards,
Gyan




More information about the ffmpeg-devel mailing list