split an audio file using ffmpeg

To split an audio (.mp3 in my case) into subcomponents (to extract portions of the file), you can do it very easily:

  1. ensure ffmpeg is installed with appropriate codecs (see convert .flv file into .mp3 file (ie. extract sound from .flv file)
  2. 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

  1. Yemi Says:

    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

  2. Amjo Says:

    True, Yemi… the “-o” parameter is for Mencoder

  3. Diarrhio Says:

    I would recommend using an -acodec copy to retain all of the original mp3 settings like bitrate, etc.

  4. ubuntuuser Says:

    ffmpeg -i file.m4b file.mp3
    mpgtx -10 file.mp3 -b newfiles

Post a Comment

Your email is never published nor shared. You're allow to say what you want...

Powered by sweet Captcha