Created
September 6, 2019 15:09
-
-
Save XVicarious/050aa118475eb3a9ad3d5b1a65142574 to your computer and use it in GitHub Desktop.
convert a soundtract to individual flacs
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
function wav2flacs | |
if [ (count $argv) -lt 2 ] | |
if [ ! -e (basename -swav $argv[1])cue ] | |
echo "No cue file of same name as wav, please specify one." | |
end | |
set cue (basename -swav $argv[1])cue | |
else | |
set cue $argv[2] | |
end | |
set wav $argv[1] | |
set tmpDir (mktemp -d) | |
mkvmerge $wav --chapters $cue -o $tmpDir/(basename -swav $wav)mkv | |
mkvmerge -D -S $tmpDir/(basename -swav $wav)mkv --split chapters:all -o $tmpDir/split-%02d.mkv | |
set titles (grep -aE '\ TITLE' $cue | sed -E 's/(^[^"]+?"|"[^"]+?$)|\///g') | |
echo $titles[2] | |
for i in $tmpDir/split-* | |
set numb (echo $i | sed -E "s~$tmpDir/split-([[:digit:]]+).mkv~\1~") | |
ffmpeg -i $i $titles[$numb].flac | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment