How to crop a mp3 from x to x+n using ffmpeg?

2019-01-21 17:15发布

问题:

Following this question I decided to use ffmpeg to crop MP3s. On another question I found this way of doing it:

ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3

The problem is that I don't want to crop the first 30 seconds, I want to crop from x to x+n, like from 30s to 100s. How would I go and do this?

I'm reading the man for ffmpeg but this is not really straightforward, especially since I just discovered about ffmpeg and I'm not familiar with audio/video editing softwares, so any pointers would be appreciated.

回答1:

Take a look at the -t and -ss arguments. They should do what you want.

-t duration

Restrict the transcoded/captured video sequence to the duration specified in seconds. hh:mm:ss[.xxx] syntax is also supported.

-ss position'

Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.

For example, ffmpeg -ss 30 -t 70 -i inputfile.mp3 -acodec copy outputfile.mp3 should do the trick for the range you mentioned (30s-100s).



标签: mp3 ffmpeg crop