Created
November 22, 2015 21:47
-
-
Save ptrv/c3ae653bd5b031a35a02 to your computer and use it in GitHub Desktop.
split audio file into multiple pieces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import subprocess | |
input_file = sys.argv[1] | |
seconds = sys.argv[2] | |
num_pieces = sys.argv[3] | |
for i in range(num_pieces): | |
num = i * seconds | |
output = "output/{0}.wav".format(i) | |
s = ["ffmpeg", "-i", str(input_file), "-ss", str(num), "-t", str(seconds), "-acodec", "copy", output] | |
subprocess.call(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment