0

I have a wave audio file that I want to trim in multiple points like this.

The audio is 1 hour long and I want to have first 3 minutes and from 6 min to 30 min. In another word, I want to remove 3 min to 6 min and 30 min to 60 min.

I can do with ffmpeg like this.

ffmpeg -i audio.wav -t 00:03:00 -c copy 01.wav
ffmpeg -i audio.wav -ss 00:06:00 -t 00:24:00 -c copy 02.wav
ffmpeg -i 01.wav -i 02.wav -filter_complex '[0:0][1:0]concat=n=2:v=0:a=1[out]' -map '[out]' output.wav

But if possible I want to write it in a line with options. I don't insist to use ffmpeg if it can be used from command line.

Is there way to do this?

ironsand
  • 2,179
  • 7
  • 30
  • 48
  • If you are on linux you can use `&&` to join your three command lines. See [this](http://stackoverflow.com/questions/4510640/command-line-what-is-the-purpose-of) discussion. – Rajib Nov 16 '13 at 13:27
  • Sorry, I should have state more clearly what I want. I know about `&&`, but I wanted to know there is a way to write it more easily with some options in a command. I rewrote my question a little. – ironsand Nov 17 '13 at 12:40
  • Not sure I understand what you want. More easily than `&&`? Not `ffmpeg`? Or do you mean no intermediate storage into temp files? – Rajib Nov 17 '13 at 15:39
  • I thought maybe there is a command that trim and concatenate a audio with like this, `audiotrimer audio.wav --from 0min -t 3min --from 6min -t 24min output.wav`. – ironsand Nov 18 '13 at 00:56

1 Answers1

3

Use Sox. The command would be:

sox inputfile.wav outputfile.wav trim 0 =3:00 =6:00 =24:00

for your example. See here.

In the trim parameters every pair of values are in to out. 0 is in point, 3:00 outpoint then 6:00 inpoint and 24:00 outpoint. The = sign means relative to beginning.

Rajib
  • 3,056
  • 23
  • 26