Search code examples
audioffmpegaudio-fingerprinting

Export each minute of MP3 into separate WAV


This is definitely a strange question but I'm looking for a way to split an mp3 mix of 60 minutes into 60 separate 1 minute long wav files to use with an audio fingerprinting API like Echonest.

Is this possible in a single ffmpeg command or would I have to run multiple iterations of ffmpeg with a the following values:

-ss is the startpoint in seconds. -t is the duration in seconds.


Solution

  • You can use the segment muxer in ffmpeg:

    ffmpeg -i input.mp3 -codec copy -map 0 -f segment -segment_time 60 output%03d.mp3
    

    For a 4 minute input this results in:

    $ ls -m1 output*.mp3
    output000.mp3
    output001.mp3
    output002.mp3
    output003.mp3
    

    Since -codec copy enables stream copy mode re-encoding will be avoided. See the segment documentation for more information and examples.