1

Im trying to cut multiple parts of audio with ffmpeg, i was able to find a working result (for video ) for a single filter : ffmpeg -i input.avi -vf "select='1-between(t,20,25)', setpts=N/FRAME_RATE/TB" -af "aselect='1-between(t,20,25)', asetpts=N/SR/TB" output.avi

How can i adapt this code for a multiple filters? For example if i want to remove fragments from 10to20, 50to60 etc.

Thank you

1
  • Are you dealing with a video file as input, or is this only audio? In case of the latter, you could look into sox and its trim parameter. Oct 6, 2022 at 9:30

3 Answers 3

3

You can combine several between intervals, as shown here: https://stackoverflow.com/questions/50594412/cut-multiple-parts-of-a-video-with-ffmpeg . Just copying the command from this link:

ffmpeg -i video.mp4 \
       -vf "select='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
            setpts=N/FRAME_RATE/TB" \
       -af "aselect='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
            asetpts=N/SR/TB" out.mp4
1

I was able to reach the result i want with this command : ffmpeg -i input.mp3 -af "aselect='not(between(t,10,16)+between(t,20,50))'" output.mp3

0

Copying the video to a new file and deleting the audio while doing so is the quickest and easiest technique to remove or delete audio. This method is straightforward because you don't have to re-encode the movie while you're at it. The command line to accomplish this is provided here. ffmpeg.exe -i videoWithAudio.mp4 -c:v copy -an videoWithoutAudio.mp4 -c:v copy copies the video track into videoWithoutAudio.mp4 -an tell FFmpeg to not copy the audio

2
  • If I read the question correctly the OP is not looking to remove all audio, nor do they have a video file they start with. They have an audio file from which they want to delete multiple sections in one command. Would you know how to do that? Oct 6, 2022 at 9:18
  • @SaaruLindestøkke it looks like the file the OP is dealing with has audio+video. That said, the above answer is definitely not an answer to the question.
    – PierU
    Oct 6, 2022 at 9:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .