5
1
I am attempting to take one video file and 2 audio files (.mp3 and .wav, though I could do 2 .mp3's - not limited to specific format) and combine them into one video. I have it working with the amix command, but my audio levels decrease significantly. The 2 audio files are set at different levels purposely and I would like to keep the levels of both files the same and just combine them.
I have tried these commands:
-filter_complex "amix=inputs=2"
-filter_complex "aresample=48000,amix=inputs=2,aformat=channel_layouts=stereo"
-filter_complex "amerge=inputs=2"
I've tried a bunch of variations on those as well. I also though about purely copying, without re-encoding the audio, but using the filter_complex, I am unable to do a pure copy. All the -map commands I tried did not give me the desired effect, though if someone has a suggestion that has worked for them, I would try -map again.
Both my audio files are normalized already so I'm not looking to normalize my audio, just keep them the exact same while merging. Has anyone dealt with anything similar? I have also looked into SoX to combine them there, but it seems to have the same affect. I'm assuming there must be some command I'm missing.
side note: the video has no audio, so I am strictly taking the 2 additional audio files and combining with a video.
UPDATE: Looks like the pan filter is giving me close to what I want. If anyone knows more about the pan to keep both my levels right, that would be helpful.
The command is
-filter_complex "amix=inputs=2,pan=stereo:c0=c0+c1:c1=c0+c1"
Using
pan
in that way will mix 1st and 2nd channels, thus video looses stereo effect. Another approach is to usevolume=2
that increases volume twice as well, but keeps stereo as is!-filter_complex "amix=inputs=2,volume=2"
– demaksee – 2015-04-30T18:56:31.420Use
volume = N tracks
for best results. – Maxim Firsoff – 2016-01-11T04:46:28.253amix
works good for me if inputs duration is the same, but volume is corrupted when I mix many inputs with different duration. Very noticeable after 10 executions (10 files to be mixed). http://stackoverflow.com/questions/35509147/ffmpeg-amix-filter-volume-issue-with-inputs-of-different-duration – cupuyc – 2016-02-19T15:59:13.8701
From the
– llogan – 2013-12-12T22:48:59.243pan
docs: If the=
in a channel specification is replaced by<
, then the gains for that specification will be renormalized so that the total is 1, thus avoiding clipping noise.