-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbraudio2flac
More file actions
executable file
·43 lines (35 loc) · 1.15 KB
/
Copy pathbraudio2flac
File metadata and controls
executable file
·43 lines (35 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
usage() { echo "$(basename $0) <file>.mkv
HOW TO GET FLAC FILES FROM BLURAY AUDIO DISCS
- First, use makemkv to get .mkv file from bluray audio disc (for 5.1 you should change the header codec from A_MS/ACM to A_PCM/INT/LIT with mkvmerge/mkvtoolnix-gui)
- Then, use this script to get .flac files from .mkv as described above
- Finally, use MusicBrainz Picard for writing tags and rename files accordingly" 1>&2; exit 1; }
if [[ -z $@ ]]; then
usage
fi
filename=`basename -s .md $@`
dirname=`dirname $@`
cd "$dirname"
if [[ ! -f $filename || -z $filename || ! $(echo $filename | grep '.mkv') ]]; then
usage
fi
### OPTIONS (hardcoded) ###
# audio track position on bluray disc
audiotrack=1
# songs to extract
firsttrack=1
lasttrack=99
# split songs by chapter
# mkvmerge -o out.mkv --split chapters:all $filename
for var in `seq $firsttrack $lasttrack`
do
i=$(printf %03d $var)
# if [[ ! -f out-$i.mkv ]]; then
# break
# fi
# convert mkv to wav
mkvextract tracks out-$i.mkv $audiotrack:out-$i.wav
ffmpeg -i out-$i.wav out-$i.flac
done
# clean mkv and temporary files
# rm $filename out*.wav out*.mkv