問題描述
avconv 改變音頻文件的音量 (avconv change volume of an audio file)
我想更改第二個音頻文件的音量,但到目前為止我嘗試的一切都不起作用。
avconv ‑i input1.mp3 ‑i input2.mp3 ‑aq 1 ‑ filter_complex amix=inputs=2:duration=first:dropout_transition=2 output.mp3
參考解法
方法 1:
This is using FFmpeg, but I suspect it would be similar for avconv. All I did was adapt this answer until it seemed to have the desired effect on my test files.
Test files
ffmpeg ‑f lavfi ‑i "anoisesrc=d=20:c=brown:r=44100:a=0.5" ‑q:a 1 input1.mp3
ffmpeg ‑f lavfi ‑i "sine=frequency=1000:duration=20" ‑q:a 1 input2.mp3
No attenuation
ffmpeg ‑i input1.mp3 ‑i input2.mp3 ‑filter_complex \
"[0:a]volume=1.0:precision=fixed[a0]; \
[1:a]volume=1.0:precision=fixed[a1]; \
[a0][a1]amix=inputs=2:dropout_transition=2" ‑q:a 1 output1.mp3
50% attenuation of the first input file
ffmpeg ‑i input1.mp3 ‑i input2.mp3 ‑filter_complex \
"[0:a]volume=1.0:precision=fixed[a0]; \
[1:a]volume=0.5:precision=fixed[a1]; \
[a0][a1]amix=inputs=2:dropout_transition=2" ‑q:a 1 output2.mp3
50% attenuation of the second input file
ffmpeg ‑i input1.mp3 ‑i input2.mp3 ‑filter_complex \
"[0:a]volume=0.5:precision=fixed[a0]; \
[1:a]volume=1.0:precision=fixed[a1]; \
[a0][a1]amix=inputs=2:dropout_transition=2" ‑q:a 1 output3.mp3