I want to edit audio and change its volume using FFmpeg.
Here is my command:
-af adelay=1000|1000 delay audio by one sec
-af volume=2dB change its volume
They both work fine, but I can only choose either of them to apply on the command, can I do both of them?
  

update:
Here is the full command I'm using. It mixes and trims two audios into the video.

C:\Users\ffmpeg.exe -y -framerate 30 -start_number 0 -i C:\Users\Scene1_%03d.png -ss 0.0 -t 5.2 -i C:\Users\sound01.wav -ss 3.466666666666667 -t 5.2 -i C:\Users\sound02.wav -filter_complex "[1] aformat=sample_fmts=s16p:sample_rates=44100:channel_layouts=stereo [a1]; [a1]adelay=1700.0|1700.0,apad,volume=0.1dB[b1]; [2] aformat=sample_fmts=s16p:sample_rates=44100:channel_layouts=stereo [a2]; [a2]adelay=5000.0|5000.0,volume=0.1dB[b2]; [b1][b2]amerge=2[a]" -map 0:v -map [a] -b:v 2800k -c:v libopenh264 -c:a mp3 -ac 2 C:\Users\test.mp4

I would like to add volume=0.1dB into filter_complex, but I'm getting this error:

[Parsed_amerge_7 @ 0000025f0dc1d3c0] No channel layout for input 1Last message repeated 1 times[AVFilterGraph @ 0000025f0db2ef00] The following filters could not choose their formats: Parsed_amerge_7Consider inserting the (a)format filter near their input or output.Error reinitializing filters!Failed to inject frame into filter network: I/O errorError while processing the decoded data for stream #2:0Conversion failed!:0

  • 1
    Please include the full command-line output, not just the error. Thanks.– slhckApr 20 at 9:32

Of course you can do both… separate them by a comma:

-af "adelay=1000|1000,volume=2dB"

See the filtering guide for more info.

  • Thanks, it works when I only have one audio, if I want to use it in filter-complex, it didn't work.– IvesApr 20 at 9:11
  • Like this -filter_complex "[1] aformat=sample_fmts=s16p:sample_rates=44100:channel_layouts=stereo [a1]; [a1]adelay=1700.0|1700.0,volume=0.1dB[b1]– IvesApr 20 at 9:12
  • 1
    Please be more specific about “it didn't work”. If you have an actual example, please edit your question and include the full command you are trying, and the full command line output including any errors you get.– slhckApr 20 at 9:21
  • Sorry for not being clear, I edited my post, please check it out.– IvesApr 20 at 9:32

I found the answer to my post.
volume should be written before aformat, like so

-filter_complex "[1] volume=0.1dB,aformat=sample_fmts=s16p:sample_rates=44100:channel_layouts=stereo [a1];

    Your Answer

     
    discard

    By posting your answer, you agree to the privacy policy and terms of service.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.