Skip to content

Instantly share code, notes, and snippets.

@devpruthvi
Created November 21, 2015 14:08
Show Gist options
  • Save devpruthvi/740fbae2a25f4aa0d00c to your computer and use it in GitHub Desktop.
Save devpruthvi/740fbae2a25f4aa0d00c to your computer and use it in GitHub Desktop.
from mutagen.mp3 import MP3
import subprocess,math
filepath = 'H:/Music/temp/'
filename = 'notafraid.mp3'
a = MP3(filepath + filename)
parts = int(math.ceil(a.info.length / 60))
for each in range(0,parts):
command = 'ffmpeg -ss {} -i {} -c copy -t {} {}{}'.format(each*60,filepath+filename,60,each,filename)
subprocess.call(command,shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment