Created
December 10, 2015 14:50
-
-
Save cerisier/0165f645abf7b2d00604 to your computer and use it in GitHub Desktop.
Split iTunes (m4a) chapters into tracks
This file contains 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 csv | |
import sys | |
# Reads input generated from ffprobe. Example below. | |
# ffprobe -v error -select_streams a:0 -show_entries stream=nb_read_frames ABGT160_847378.m4a | |
reader = csv.reader(sys.stdin, delimiter=',') | |
audio_file = sys.argv[1] | |
for row in reader: | |
start = row[4] | |
duration = float(row[6])-float(row[4]) | |
title = row[7] | |
print "ffmpeg -ss %s -i %s -t %s -acodec copy \"%s.wav\"" % (audio_file, start, duration, title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment