[FFmpeg-user] Dim audio in parts where there is a lot of wind

Paul B Mahol onemda at gmail.com
Sat Jun 3 12:54:29 EEST 2023


On Sat, Jun 3, 2023 at 11:49 AM Cecil Westerhof via ffmpeg-user <
ffmpeg-user at ffmpeg.org> wrote:

> Michael Koch <astroelectronic at t-online.de> writes:
>
> > Am 02.06.2023 um 17:37 schrieb Cecil Westerhof via ffmpeg-user:
> >>
> >> This is abrupt. (It is better as nothing.) I would prefer it to slide
> >> to for example 25% and a the end slide back to 100%. Something like:
> >>      -                        -
> >>       -                      -
> >>        -                    -
> >>         -                  -
> >>          -                -
> >>           ----------------
> >
> > I have added a simpler solution with "sendcmd" to chapter 3.5.
> > http://www.astro-electronic.de/FFmpeg_Book.pdf
>
> I did it with:
>     inputfile=00096.MTS
>     outputfile=00096.mkv
>     start=31
>     end=44
>     ramp=1.5
>     volume=0.05
>     volumeCmd="
>       '
>         lerp(1, ${volume}, (t - ${start}) / (${ramp}))
>         *
>         between(t, ${start}, ${start} + ${ramp})
>
>         +
>
>         lerp(${volume}, 1, (t - ${end} + ${ramp}) / (${ramp}))
>         *
>         between(t, ${end} - ${ramp}, ${end})
>
>         +
>
>         ${volume}
>         *
>         bitand(gt(t, ${start} + ${ramp}), lt(t, ${end} - ${ramp}))
>       '
>       :enable='between(t, ${start}, ${end})'
>       :eval=frame
>     "
>
>     ffmpeg -i ${inputfile}           \
>            -vcodec copy              \
>            -af "volume=${volumeCmd}" \
>            -y ${outputfile}
>
> The distortion by the wind was very loud, so the volume needed to be
> set very low.
>
> I think it is not necessary at the moment, but what if there are
> several parts in the video where the audio has to be dimmed?
>
>
> By the way: it is quit fast. :-D
>

This does not take into account that audio frames processed by filter can
be big and not single sample, and thus this always create artifacts in
resulted file.
May not be always evident from listening, exp. if audio is of low quality.


>
> --
> Cecil Westerhof
> Senior Software Engineer
> LinkedIn: http://www.linkedin.com/in/cecilwesterhof
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list