How do I add some other audio to the muted section

2019-06-10 09:10发布

问题:

I am muting a section of the audio file as below. How can I add some other audio to the muted section of the audio using ffmpeg?

FFmpeg ffmpeg = new FFmpeg("ffmpeg");
FFprobe ffprobe = new FFprobe("ffprobe");
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
FFmpegProbeResult in = ffprobe.probe("Input.wav");
FFmpegBuilder builder = new **FFmpegBuilder().setInput(in).addOutput("Output.wav").setAudioFilter("volume=enable='between(t,94,123)':volume=0").done();**
executor.createJob(builder).run();

回答1:

The convenient way to do this is to trim the source and concat with the new audio.

ffmpeg -i in.wav -i insert.wav -filter_complex "[0]atrim=0:94[pre];[0]atrim=124,asetpts=PTS-STARTPTS[post];[1]atrim=0:30[mid];[pre][mid][post]concat=n=3:v=0:a=1" out.wav


标签: audio ffmpeg