-3

Please can anyone explain me how to change/set volume for audio while it is playing.

Edit from comment: I am using ffmpeg as a decoder and using it with SDL_MIXER. I have added 'volume' filter and set initial volume value. When it is playing i want to set new value of volume. One more thing i am streaming the audio.

5
  • 4
    ffmpeg is not a media player, so I don't understand what you are talking about by "while it is playing". Also, you don't mention what you have tried, like for example using your system mixer. Perhaps you mean ffplay?
    – gertvdijk
    May 12, 2015 at 7:07
  • Actually i am using ffmpeg as a decoder and using it with SDL_MIXER. I have added 'volume' filter and set initial volume value. When it is playing i want to set new value of volume. One more thing i am streaming the audio. Thanks
    – SomGG
    May 12, 2015 at 10:13
  • 1
    Crossposting is discouraged. Please do not ask the same question on multiple Stack Exchange sites.
    – llogan
    May 12, 2015 at 17:47
  • @gertvdijk ffmpeg can actually be used as a media player via the various output devices (such as sdl).
    – llogan
    May 12, 2015 at 17:50
  • @LordNeckbeard Well, I'd say that's unusual at least. The OP should have mentioned that in the original posted question I think. Thanks. :-)
    – gertvdijk
    May 12, 2015 at 17:58

1 Answer 1

4

To increase the volume with ffmpeg use the commad:

ffmpeg -i input.wav -af 'volume=2' output.wav

Replace volume=X with a suitable number. For example 0.5 will half, 2 will double the volume.

11
  • THE OP asks for changing volume when playing
    – Maythux
    May 12, 2015 at 7:07
  • Your answer for how to control audio volume while converting
    – Maythux
    May 12, 2015 at 7:08
  • 1
    What does this mean How to control volume in FFMPEG. FFMPEG is not an audio player.
    – Pabi
    May 12, 2015 at 7:17
  • 1
    The title is quite clear, not all people speak english well to formulate the question. I think my answer provides the most suitable solution.. Like I said we will see when OP edits his question maybe he can make clear what he wants.
    – Pabi
    May 12, 2015 at 7:19
  • 1
    I think this is a reasonable answer, considering the way the question was asked. One interpretation of "how to change volume for audio while it is playing" is "how to change the volume that the audio will have when the audio plays" (i.e., "when it is playing" could be modifying "the volume..." rather than "to change the volume..."). Of course, the question is somewhat unclear, and hopefully the OP will edit it soon. May 12, 2015 at 8:33

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