Split mp3 file with ffmpeg

Quick bit of code for next time I have to split an MP3 up.

pull out a half hour chunk from the start of an audio file:

ffmpeg -i your_audio_file.mp3 -acodec copy -t 00:30:00 -ss 00:00:00 half_hour_split.mp3

split an audio file (that is just under 5 hours long) into half an hour chunks using ffmpeg, into a folder called “split”

mkdir split; X=0; while( [ $X -lt 5 ] ); do echo $X; ffmpeg -i big_audio_file.mp3 -acodec copy -t 00:30:00 -ss 0$X:00:00 split/${X}a.mp3; ffmpeg -i big_audio_file.mp3 -acodec copy -t 00:30:00 -ss 0$X:30:00 split/${X}b.mp3;  X=$((X+1)); done;

1 thought on “Split mp3 file with ffmpeg

Leave a Reply

Your email address will not be published. Required fields are marked *