Chitika

Monday, October 27, 2014

Windows ffmpeg split mp3 file into pieces

The other day I was listening a long (more than an hour long) audio file on car stereo using memory stick. I had to stop in between playing, after reaching destination. When I again take the driving seat, the recording started from start. I came to know that there is no memory feature in most of car stereos for storing last playback position.

The solution come to my mind is to split the recording into 10 minutes pieces each. I used following commands for it:

for /L %i IN (1, 600, 9999) DO (ffmpeg -ss %i -i recording.mp3 -c copy -t 600 recording-%i.mp3)

Where 600, is the pieces playback time, i.e. 10 minutes * 60 seconds = 600
9999, is the total playback time in seconds, keep it extra past the playback time, say if your playback time is 1 hour 30 minutes, set it to 1 = 60 mins + 30 minutes = 90 mins (add extra 10 minutes, make it 100 minutes), 100 * 60 = 6000, you can use 6000.

sources:
http://superuser.com/questions/525210/splitting-an-audio-file-into-chunks-of-a-specified-length
http://serverfault.com/questions/59014/for-loop-counting-from-1-to-n-in-a-windows-bat-script