0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CD manipulatorで保存していおいたimg+cueをtagが埋め込まれたflacファイルに変換する

Posted at

はじめに

物理的なCDってそのうち劣化するらしいじゃんってことでCD Manipulatorでimg+cue形式にしてとりあえず取り込んでいるわけですが、せっかく読み込み終わったこのデータをCLIでflacに変換できないものかと思って調べました
色々寄り道したのにシンプルなコマンドになってしまった・・・(初手ChatGPTで失敗した)

環境

  • OS
    • Ubuntu 24.04
      • ツール導入楽ちん、dockerやLinux Containerでもできそう
  • 導入するパッケージ
    • flac
    • abcde

手順

# cueタグが埋め込まれた単一flacファイルに変換する
$ flac -f --best --force-raw-format --endian=little --channels=2 --bps=16 --sample-rate=44100 --sign=signed --cuesheet='hogehoge.cue' 'hogehoge.img'

# cueタグが埋め込まれた単一flacファイルを各楽曲のflacファイルに分割して楽曲情報を埋め込む
# --> `-N`以降はChatGPTに出してもらったオプションで未精査、そのうちアップデートするつもり
$ abcde -d 'hogehoge.flac' -N -o flac -x -a default,cddb,read,encode,tag
  • できたら指定したいオプション
    • 分割済みflacの出力先dir指定したい
    • ファイル名に曲名入れたくない
    • CDのデータベースなんとかならんか

実行例(成功)

$ flac -f --best --force-raw-format --endian=little --channels=2 --bps=16 --sample-rate=44100 --sign=signed --cuesheet='20161123 - ningen kaika.cue' '20161123 - ningen kaika.img'

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

20161123 - ningen kaika.img: wrote 476686052 bytes, ratio=0.632
$ abcde -d '20161123 - ningen kaika.flac' -N -o flac -x -a default,cddb,read,encode,tag
Grabbing entire CD - tracks:  01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
Retrieved 1 match...
#1 (Musicbrainz): ---- RADWIMPS / 人間開花 ----
1: Lights go out
2: 光
3: AADAAKOODAA
4: トアルハルノヒ
5: 前前前世 [original ver.]
6: 'I' Novel
7: アメノヒニキク
8: 週刊少年ジャンプ
9: 棒人間
10: 記号として
11: ヒトボシ
12: スパークル [original ver.]
13: Bring me the morning
14: O&O
15: 告白

Selected: #1 (RADWIMPS / 人間開花)
Edit selected CDDB data [y/N]?
Is the CD multi-artist [y/N]? n
Grabbing track 01: Lights go out...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

20161123 - ningen kaika.flac: done
Grabbing track 02: 光...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

20161123 - ningen kaika.flac: done

(中略)

Grabbing track 15: 告白...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

20161123 - ningen kaika.flac: done
Encoding track 06 of 15: 'I' Novel...
Tagging track 06 of 15: 'I' Novel...
Encoding track 07 of 15: アメノヒニキク...
Tagging track 07 of 15: アメノヒニキク...
Encoding track 08 of 15: 週刊少年ジャンプ...
Tagging track 08 of 15: 週刊少年ジャンプ...
Encoding track 09 of 15: 棒人間...
Tagging track 09 of 15: 棒人間...
Encoding track 10 of 15: 記号として...
Tagging track 10 of 15: 記号として...
Encoding track 11 of 15: ヒトボシ...
Tagging track 11 of 15: ヒトボシ...
Encoding track 12 of 15: スパークル [original ver.]...
Tagging track 12 of 15: スパークル [original ver.]...
Encoding track 13 of 15: Bring me the morning...
Tagging track 13 of 15: Bring me the morning...
Encoding track 14 of 15: O&O...
Tagging track 14 of 15: O&O...
Encoding track 15 of 15: 告白...
Tagging track 15 of 15: 告白...
Finished.
$ metaflac --show-all-tags RADWIMPS-人間開花/01.Lights_go_out.flac
ARTIST=RADWIMPS
ALBUM=人間開花
TITLE=Lights go out
DATE=2016
TRACKNUMBER=01
TRACKTOTAL=15
CDDB=cc10b60f

実行例(失敗)

あまり新しいとうまくいかないっぽい

$ flac -f --best --force-raw-format --endian=little --channels=2 --bps=16 --sample-rate=44100 --sign=signed --cuesheet=fukuyama_akira.cue fukuyama_akira.img

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

fukuyama_akira.img: wrote 524111875 bytes, ratio=0.706
$ abcde -d fukuyama_akira.flac -N -o flac -x -a default,cddb,read,encode,tag
Grabbing entire CD - tracks:  01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17
MusicBrainz lookup returned an error "Not Found"
No lookup matches.
---- Unknown Artist / Unknown Album ----
1: Track 1
2: Track 2
3: Track 3
4: Track 4
5: Track 5
6: Track 6
7: Track 7
8: Track 8
9: Track 9
10: Track 10
11: Track 11
12: Track 12
13: Track 13
14: Track 14
15: Track 15
16: Track 16
17: Track 17

Selected: #0 (Unknown Artist / Unknown Album)
Edit selected CDDB data [y/N]?
Is the CD multi-artist [y/N]? n
Grabbing track 01: Track 1...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

fukuyama_akira.flac: done
Grabbing track 02: Track 2...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

fukuyama_akira.flac: done
Grabbing track 03: Track 3...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

fukuyama_akira.flac: done

(中略)

Grabbing track 16: Track 16...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

fukuyama_akira.flac: done
Grabbing track 17: Track 17...

flac 1.4.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2023  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

fukuyama_akira.flac: done
Tagging track 06 of 17: Track 6...
Encoding track 07 of 17: Track 7...
Tagging track 07 of 17: Track 7...
Encoding track 08 of 17: Track 8...
Tagging track 08 of 17: Track 8...
Encoding track 09 of 17: Track 9...
Tagging track 09 of 17: Track 9...
Encoding track 10 of 17: Track 10...
Tagging track 10 of 17: Track 10...
Encoding track 11 of 17: Track 11...
Tagging track 11 of 17: Track 11...
Encoding track 12 of 17: Track 12...
Tagging track 12 of 17: Track 12...
Encoding track 13 of 17: Track 13...
Tagging track 13 of 17: Track 13...
Encoding track 14 of 17: Track 14...
Tagging track 14 of 17: Track 14...
Encoding track 15 of 17: Track 15...
Tagging track 15 of 17: Track 15...
Encoding track 16 of 17: Track 16...
Tagging track 16 of 17: Track 16...
Encoding track 17 of 17: Track 17...
Tagging track 17 of 17: Track 17...
Finished.

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?