How to remove a section from an audio and keep the

2020-06-27 02:21发布

问题:

I'm trying to remove a section from an audio. For example I want to remove from 30s to 45s and have the rest with me. What I'm doing is the following:

ffmpeg -i input.mp3 -filter_complex "[0]atrim=duration=30[a];[0]atrim=start=45[b];[a][b]concat" output.mp3

But unfortunately this doesn't seem to work.

What I obtain is the following error:

[Parsed_atrim_0 @ 00000000000c8700] Media type mismatch between the 'Parsed_atrim_0' filter output pad 0 (audio) and the 'Parsed_concat_2' filter input pad 0 (video)
[AVFilterGraph @ 0000000002435260] Cannot create the link atrim:0 -> concat:0
Error initializing complex filters.
Invalid argument

回答1:

The concat filter by default expects to output 1 video stream and 0 audio streams. Use concat=n=2:v=0:a=1:

ffmpeg -i input.mp3 -filter_complex "[0]atrim=duration=30[a];[0]atrim=start=45[b];[a][b]concat=n=2:v=0:a=1" output.mp3


标签: audio ffmpeg