def cut_file(file, start_time, end_time):
""" Cut the mp3 file with start and end time. """
output = file[:-4] + "_cut.mp3"
p=Popen(["ffmpeg", "-i", file, "-c:a copy -ss", start_time, "-to", end_time, output], stdout=PIPE)
Unknown encoder '0:07'
Since you're passing all the arguments list-style (which is good practice), you need to split all the arguments space-wise, otherwise
Popen will quote-protect the ones containing spaces to respect what you passed.
"-c:a copy -ss" is interpreted as one argument, which probably explains why ffmpeg is tring to read your start time as an encoder.
What's really issued to the system call is:
ffmpeg -i file "-c:a copy -ss" start_time -to end_time output
Do that instead:
p=Popen(["ffmpeg", "-i", file, "-c:a","copy","-ss", start_time, "-to", end_time, output], stdout=PIPE)