1

Need to merge for example 3 videos with/without sound and add soundtrack from mp3 to those who doesn't have sound (videos with sound is known before):

melt 1.mp4 2sound.mp4 -mix 30 -mixer luma 3.mp4 -mix 30 -mixer luma -track music.mp3

Added soundtrack (music.mp3) must be 100% volume on 1 and 3 videos, and 30% volume mixed with 2sound.mp4 built in sound track. That's possible?

user2455079
  • 420
  • 4
  • 16

1 Answers1

4

You can use the "volume" filter to animate the volume of the music track. You just need to know the frame when the clip with sound start and stops. You can use the mix transition to blend the audio of the two tracks.

For example, if 2sound.mp4 starts at 500 and ends at 1000, the command would be:

melt 1.mp4 2sound.mp4 -mix 30 -mixer luma 3.mp4 -mix 30 -mixer luma -track music.mp3 -filter volume level=0=0;500=-12;1000=0 -transition mix

In this example, the level is set to 0db for the first 500 frames (during 1.mp4), -12db for frames 500-1000 (during 2sound.mp4) and then back to 0dB during 3.mp4.

Volume filter documentation: https://www.mltframework.org/plugins/FilterVolume/

Mix transition documentation: https://www.mltframework.org/plugins/TransitionMix/

Brian
  • 1,200
  • 6
  • 8
  • -track music.mp3 overwrites whole sound in all video clips, how to avoid overwriting it, mix it instead – user2455079 Apr 07 '17 at 06:27
  • You can mix the audio from the two tracks using the "mix" transition. I updated the answer to include that. – Brian Apr 07 '17 at 12:17
  • This didn't work for me. The level=0=0;500=-12;1000=0 through nasty errors and I looked in the code and didn't see anything that would handle that. I ended up using multiple -filter volume level=X in=Start out=End ie -filter volume level=0 out=500 -filter volume level=-12 in=500 out=1000 -filter volume level=0 in=1000 – ezwrighter Aug 04 '17 at 21:18
  • ezwrighter: what version of MLT are you using? Animation of the "level" parameter was added in August/September of 2014 - which would have been released in v0.94. Before that release, you could not use animation syntax with the "level" parameter. – Brian Aug 17 '17 at 14:28