Endeavor to both TRIM and apply IN and OUT fades to a number of MP3 files using ffmpeg. Specifically trimming off a [400mS] length from the start, followed by a [400mS] fade up to full volume, then a [400mS] fade down at the conclusion of the recording. My obstacle is making the fade out function correctly.
Have employed ffprobe to determine the total length of the file which is used in the $END variable. The following command appears to work correctly for the trim and the afade-in.
ffmpeg -ss 00:00.4 -i "$FILENAME" -af "afade=t=in:st=0:d=0.4" -c:a libmp3lame "$NEWFILENAME"
However, adding the afade-out breaks the command and results in error with "Conversion failed!".
-af "afade=t=in:st=0:d=0.4,afade=t=out:st=$END:d=0.4"
Typical transaction follows with error details.
type [mp3 @ 0x557572b829c0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'kef.reports-know.how.mp3':
Metadata:
artist : KEF Reports
title : Know how
encoded_by : Layer 3, Codec
track : 617
Duration: 00:03:48.62, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[afade @ 0x557572ba0880] Value 3.000000 for parameter 'type' out of range [0 - 1]
Last message repeated 1 times
[afade @ 0x557572ba0880] Error setting option type to value 03.
[Parsed_afade_0 @ 0x557572ba0780] Error applying options to the filter.
[AVFilterGraph @ 0x557572b864c0] Error initializing filter 'afade' with args 't=out:st=00:03:48.620:d=0.3'
Error reinitializing filters!
Failed to inject frame into filter network: Numerical result out of range
Error while processing the decoded data for stream #0:0
Conversion failed!
Bewildered by, "Value 3.000000 for parameter 'type' out of range [0 - 1]".
Thanks in advance,
Have experimented with the afade-out parameters without success.