To split an audio (.mp3 in my case) into subcomponents (to extract portions of the file), you can do it very easily:
- ensure ffmpeg is installed with appropriate codecs (see convert .flv file into .mp3 file (ie. extract sound from .flv file)
- open a terminal and run :
ffmpeg -f mp3 -i /path/to/file.mp3 -t hh:mm:ss[.xxx] -ss hh:mm:ss[.xxx] -o /path/to/save.mp3
where:
- “-t” option is for the duration of your split
- “-ss” option is where you want your split to start (optional if you want to start at beginning of the file)
- “hh:mm:ss[.xxx]” is a time format where you replace hh, mm, ss, xxx with corresponding hours, minutes, seconds, milliseconds respectively. Milliseconds are in squared brackets to highlight that they are optionals and when specified, must be prepended by a dot.
sources
- man ffmpeg
4 Comments: Trackback URL | Comments RSS
April 11th, 2011 at 2:29 pm
Hi Just a small correction to the code example above. “-o” will throw an error in ffmpeg as its not a valid option. Should be “-y /path/to/output_filename.mp3″.
So updated code should read:
ffmpeg -f mp3 -i /path/to/file.mp3 -t hh:mm:ss[.xxx] -ss hh:mm:ss[.xxx] -y /path/to/save.mp3
Hope it helps
Yemz
June 9th, 2011 at 4:40 pm
True, Yemi… the “-o” parameter is for Mencoder
August 11th, 2011 at 6:30 pm
I would recommend using an -acodec copy to retain all of the original mp3 settings like bitrate, etc.
September 6th, 2011 at 2:25 pm
ffmpeg -i file.m4b file.mp3
mpgtx -10 file.mp3 -b newfiles