投げ銭

★当サイトへの投げ銭(PayPal)★

LINK


(無償、寄付歓迎) logo
世界中で使われるISO標準オフィスソフト(MSオフィス互換)

★LibreOfficeの導入事例★
詳細について

人気の投稿(1ヶ月間)

Ad

Ad

投げ銭

★当サイトへの投げ銭(PayPal)★

2020年7月23日木曜日

【Linux mint 19.3】コマンドラインから音楽CDをリッピングしmp3形式などで保存する【CUIリッピングソフト abcde】

CUIで動作するリッピングソフトウェアabcdeを用いて音楽CDをリッピングする方法

abcdeを用いれば、読み取り速度を任意に指定できる。
他の標準的なリッピングソフトウェアでは読み取り時にエラーが出るような音楽CDでも、
abcdeを用いれば速度を落としてリッピングできた。
速度を落としたり、mp3のビットレートを指定したり、オプション指定については最後に記述した。


■Linux mintのバージョン

$ cat /etc/issue
Linux Mint 19.3 Tricia \n \l


■必要なパッケージのインストール

下記にまとめたように、パッケージの導入では1〜5までの手順がある。
これはインストールコマンドのみをピックアップしたものなので、必ず、続く本文を参照してください。

手順2のパッケージはシステムに導入済みのPythonバージョンによって異なるので、本文を参考にしてください。

楽曲名をデータベースから引いてくる必要がなければ、3までのパッケージのインストールのみで良かった。

手順の5はとても時間がかかった。

1、apt-get install abcde
2、apt-get install python-eyed3 eyed3 (Pythonのバージョンによって異なる)
3、apt-get install lame
(可逆圧縮flac形式を使いたい場合、sudo apt-get install flac )
4、apt-get install libmusicbrainz-discid-perl libwebservice-musicbrainz-perl
5、(cpanにおいて)upgrade WebService::MusicBrainz


以下、本文で、インストール手順である。

まず、rootユーザーになった。
# sudo su

そして、動作テストも行うので、CDドライブに適当な音楽CDをセットしておく。


1、abcdeパッケージのインストール

◯ abcdeのインストールを行った。
# apt-get install abcde


2、eyed3パッケージのインストール

動作確認
# abcde -o mp3
[ERROR] abcde: eyeD3 is not in your path.
[INFO] Define the full path to the executable if it exists on your system.
[INFO] Hint: sudo apt-get install
必要なプログラムが見つからずエラーになった。
さらに必要なパッケージを導入する。


◯パッケージの検索を行った。
# apt-cache search eyed3
eyed3 - Display and manipulate id3-tags on the command-line
python-eyed3 - Python module for id3-tags manipulation (Python 2 version)python3-eyed3 - Python module for id3-tags manipulation (Python 3 version)
Pythonのバージョンによって導入するモジュールのパッケージ名が異なっている。
そこで、現システムに入っているPythonのバージョンを確認した。

◯Pythonバージョンの確認を行った。
# python -V
Python 2.7.15+
現システムのPythonバージョンは2だとわかったので、
上記一覧から python-eyed3 をインストールする。

◯2つのパッケージを導入した。
(上記手順で確認したPythonバージョンに適合したもの)
# apt-get install python-eyed3 eyed3


3、lameパッケージのインストール

abcdeが動作するか再テストした。
# abcde -o mp3
[ERROR] abcde: lame is not in your path.
[INFO] Define the full path to the executable if it exists on your system.
[INFO] Hint: sudo apt-get install lame
lameが不足しているためエラーが発生したのでこれを導入する。

◯ lameのインストールを行った。
# apt-get install lame

(可逆圧縮flac形式を使いたい場合、sudo apt-get install flac )


4、perl関係のパッケージのインストール

abcdeが動作するか再テストした。
# abcde -o mp3
dasd: 1 64  150 310892 0
4093
7513
13326
17142
23710
27693
33783
37909
44530
48139
(中略)
283252
287225
292262
295923
301108
Can't locate MusicBrainz/DiscID.pm in @INC (you may need to install the MusicBrainz::DiscID module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/bin/abcde-musicbrainz-tool line 18.
BEGIN failed--compilation aborted at /usr/bin/abcde-musicbrainz-tool line 18.
Grabbing entire CD - tracks: 01 02 03 04 05 06 07 08 09 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
Can't locate MusicBrainz/DiscID.pm in @INC (you may need to install the MusicBrainz::DiscID module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/bin/abcde-musicbrainz-tool line 18.
BEGIN failed--compilation aborted at /usr/bin/abcde-musicbrainz-tool line 18.
No Musicbrainz match.
---- 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
(中略)
60: Track 60
61: Track 61
62: Track 62
63: Track 63
64: Track 64
Edit selected CDDB data [Y/n]?
[CTRL]+^c で中断した。
上記、マーカーで色をつけたところのようにエラーが発生した。

実は、ここまでくればCDのリッピング自体は可能になる。
このエラー表示のMusicBrainzというのは楽曲名データベースである。
楽曲名を引いてこなくてよいならこのエラーを無視しても良い。

ここではさらにエラーの解消に努めた。
調べたところによると、次のパッケージを導入すると良いとわかった。

◯ perl関係のパッケージの導入を行った。
# apt-get install libmusicbrainz-discid-perl libwebservice-musicbrainz-perl


5、perl関係のモジュールのアップデート

再び、abcdeのテストを行った。
# abcde -o mp3
dasd: 1 12  150 209835 0
19960
35686
56229
71882
93359
108267
128407
149368
161425
176985
189222
Grabbing entire CD - tracks: 01 02 03 04 05 06 07 08 09 10 11 12
URL (http://musicbrainz.org/ws/1/release/?type=xml&discid=Uj**********Xk-) Request Failed - Code: 410 Error: Gone
No Musicbrainz match.
---- 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
Edit selected CDDB data [Y/n]? ^C
まだ、マーカーで色づけたようにエラーが残る。
参考サイトによれば、perlモジュールのアップデートで解消すればよいとわかった。


◯ cpanの実行とアップデート
cpan
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes] yes

Autoconfiguration complete.
commit: wrote '/root/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.

upgradeコマンドの実行
かなり時間がかかった。途中まるで無応答になったみたいに静かになるし、
エラーも表示されて心配したが、放置したままにすると30分程度かかって終了した。

 cpan[1]> upgrade WebService::MusicBrainz
Fetching with LWP:
http://www.cpan.org/authors/01mailrc.txt.gz
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://www.cpan.org/modules/02packages.details.txt.gz
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Wed, 22 Jul 2020 17:41:03 GMT
.............
  New CPAN.pm version (v2.28) available.
  [Currently running version is v2.18]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.

...............................................................DONE
Fetching with LWP:
http://www.cpan.org/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Package namespace         installed    latest  in CPAN file
WebService::MusicBrainz        0.93    v1.0.5  BFAIST/WebService-MusicBrainz-1.0.5.tar.gz
Running install for module 'WebService::MusicBrainz'
Fetching with LWP:
http://www.cpan.org/authors/id/B/BF/BFAIST/WebService-MusicBrainz-1.0.5.tar.gz
Fetching with LWP:
http://www.cpan.org/authors/id/B/BF/BFAIST/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/B/BF/BFAIST/WebService-MusicBrainz-1.0.5.tar.gz ok
Scanning cache /root/.cpan/build for sizes
DONE
'YAML' not installed, will not store persistent state
----  Unsatisfied dependencies detected during  ----
---- BFAIST/WebService-MusicBrainz-1.0.5.tar.gz ----
    Module::Build [build_requires]
Running install for module 'Module::Build'
Fetching with LWP:
http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz
Fetching with LWP:
http://www.cpan.org/authors/id/L/LE/LEONT/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz ok
Configuring L/LE/LEONT/Module-Build-0.4231.tar.gz with Makefile.PL
# running Build.PL --installdirs site
Checking optional features...
inc_bundling_support....disabled
  requires:
    ! inc::latest is not installed
ERRORS/WARNINGS FOUND IN PREREQUISITES.  You may wish to install the versions
of the modules indicated above before proceeding with this installation
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Module-Build' version '0.4231'
  LEONT/Module-Build-0.4231.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for L/LE/LEONT/Module-Build-0.4231.tar.gz
/usr/bin/perl Build --makefile_env_macros 1
Building Module-Build
  LEONT/Module-Build-0.4231.tar.gz
  /usr/bin/make -- OK
Running make test
/usr/bin/perl Build --makefile_env_macros 1 test
t/00-compile.t ................. ok   
t/PL_files.t ................... ok 
t/actions/installdeps.t ........ ok 
t/actions/manifest_skip.t ...... ok 
t/add_property.t ............... ok   
t/add_property_array.t ......... ok 
t/add_property_hash.t .......... ok 
(長い 中略)
Result: PASS
  BFAIST/WebService-MusicBrainz-1.0.5.tar.gz
  ./Build test -- OK
Running Build install
Building WebService-MusicBrainz
Installing /usr/local/share/perl/5.26.1/WebService/MusicBrainz.pm
Installing /usr/local/share/perl/5.26.1/WebService/MusicBrainz/Request.pm
Installing /usr/local/man/man3/WebService::MusicBrainz::Request.3pm
Installing /usr/local/man/man3/WebService::MusicBrainz.3pm
  BFAIST/WebService-MusicBrainz-1.0.5.tar.gz
  ./Build install  -- OK
cpan[2]> 
途中、表示内容を省略した。

以上で、インストールが完了した。


通常ユーザーに戻っておく。
# exit


■abcdeの動作確認

CDドライブに適当な音楽CDをセットしてから、次のコマンドを実行した。
mp3形式で出力するようにオプション指定した。

このCDについて、楽曲情報がデータベースに見つからなかった。

$ abcde -o mp3
dasd: 1 14  150 308902 0
25395
47155
70722
92670
114235
132887
152587
174595
195070
218470
241860
265932
285847
Grabbing entire CD - tracks: 01 02 03 04 05 06 07 08 09 10 11 12 13 14
abcde: attempting to resume from /home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-..
No Musicbrainz match.
---- 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
楽曲タイトルの編集もできるようだが、Noを選択した。
Edit selected CDDB data [y/N]? n
Is the CD multi-artist [y/N]? n

すると、トラック1から読み取りが始まった。
Grabbing track 01: Track 1...
cdparanoia III release 10.2 (September 11, 2008)
Ripping from sector       0 (track  1 [0:00.00])
  to sector   25394 (track  1 [5:38.44])
outputting to /home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-/track01.wav
 (== PROGRESS == [                              | 025394 00 ] == :^D * ==) 
Done.
abcde.4zigtquBk61IxpjK_Q.8r26IKjo- というフォルダがカレントディレクトリに作られ、
track01.wav というファイルが作られていた。

そのまま、トラック2の読み取りが始まるが、同時並行して、
Unknown_Artist-Unknown_Album というフォルダも作られ、内部に、
01.Track_1.mp3 というファイルが作られた。


以下、最終トラックまで繰り返された。
Grabbing track 02: Track 2...
cdparanoia III release 10.2 (September 11, 2008)
Ripping from sector   25395 (track  2 [0:00.00])
  to sector   47154 (track  2 [4:50.09])
outputting to /home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-/track02.wav
 (== PROGRESS == [                              | 047154 00 ] == :^D * ==) 
Done.
(省略)
Grabbing track 14: Track 14...
cdparanoia III release 10.2 (September 11, 2008)
Ripping from sector  285847 (track 14 [0:00.00])
  to sector  308901 (track 14 [5:07.29])
outputting to /home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-/track14.wav
 (== PROGRESS == [                              | 308901 00 ] == :^D * ==) 
Done.
最終トラックまで完了すると、次のメッセージが表示されて終了した。
Encoding track 14 of 14: Track 14...
LAME 3.100 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding /home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-/track14.wav
      to /home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-/track14.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
 11769/11769 (100%)|    0:14/    0:14|    0:14/    0:14|   21.397x|    0:00
-------------------------------------------------------------------------------------------------------
   kbps        LR    MS  %     long switch short %
  128.0       12.8  87.2        98.8   0.7   0.5
Writing LAME Tag...done
ReplayGain: -7.8dB
Tagging track 14 of 14: Track 14...
/home/user/abcde.4zigtquBk61IxpjK_Q.8r26IKjo-/track14.mp3                                  [ 4.69 MB ]
--------------------------------------------------------------------------------------------------------
Setting artist: Unknown Artist
Setting album: Unknown Album
Setting title: Track 14
Setting genre: 255
eyed3.id3:WARNING: Invalid numeric genre ID: 255
Invalid numeric genre ID: 255
Finished.

mp3の保存先フォルダの内容を確認した。

$ cd Unknown_Artist-Unknown_Album/
$ ls -all
total 64520
drwxrwxr-x  2 user user    4096 Jul 23 08:37 .
drwx------ 27 user user   12288 Jul 23 08:37 ..
-rw-rw-r--  1 user user 5418839 Jul 23 08:29 01.Track_1.mp3
-rw-rw-r--  1 user user 4643107 Jul 23 08:30 02.Track_2.mp3
-rw-rw-r--  1 user user 5028466 Jul 23 08:30 03.Track_3.mp3
-rw-rw-r--  1 user user 4683231 Jul 23 08:31 04.Track_4.mp3
-rw-rw-r--  1 user user 4601729 Jul 23 08:32 05.Track_5.mp3
-rw-rw-r--  1 user user 3980224 Jul 23 08:32 06.Track_6.mp3
-rw-rw-r--  1 user user 4203832 Jul 23 08:33 07.Track_7.mp3
-rw-rw-r--  1 user user 4696188 Jul 23 08:34 08.Track_8.mp3
-rw-rw-r--  1 user user 4368926 Jul 23 08:34 09.Track_9.mp3
-rw-rw-r--  1 user user 4992939 Jul 23 08:35 10.Track_10.mp3
-rw-rw-r--  1 user user 4990849 Jul 23 08:36 11.Track_11.mp3
-rw-rw-r--  1 user user 5136299 Jul 23 08:36 12.Track_12.mp3
-rw-rw-r--  1 user user 4249390 Jul 23 08:37 13.Track_13.mp3
-rw-rw-r--  1 user user 4919378 Jul 23 08:37 14.Track_14.mp3


■音楽CD読み取り時のその他のオプション指定

abcdeは、音楽CD読み取りの際に、読み取りについてオプションを指定できる。


◯例えば次のコマンドは、読み取り速度 13倍速で、トラック49から読み取っている。

$ abcde -S 13 -t 49 -o mp3

他のリッピングソフトを利用していたとき、
多数のトラックを含む音楽CDを、ラップトップPCの薄型CD/DVDドライブで読み取ろうとすると、
後の方のトラックの読み取りに必ず失敗する問題に遭遇していた。
しかし、ソフトをabcdeに切り替えてさらに読み取り速度を指定して下げることによって安定して読み取りができるようになった。
このように速度調整を意図してできるので重宝している。


◯また、次のコマンドは、mp3のビットレート(kbps)を指定している。

・320Kbps
$ abcde -o "mp3:-b 320"

・160Kbps
$ abcde -o "mp3:-b 160"

当然、仕上がりのmp3ファイルのサイズは変化する。
デフォルトのビットレートは128Kbpsになっていた。


◯flac形式で圧縮したい場合

(可逆圧縮flac形式を使いたい場合、sudo apt-get install flac が必要)
$ abcde -o flac

ドライブを指定したい場合(デバイス名 /dev/sr1などは予め調べておく。)
$ abcde -d /dev/sr1 -o flac

次のエラーが発生する場合には、上記のようにデバイス名を指定すると良かった。

[WARNING] something went wrong while querying the CD... Maybe a DATA CD?
[WARNING] Error trying to calculate disc ids without lead-out information.



その他、指定可能なオプションの一覧は次の通り。

$ abcde -h
This is abcde v2.8.1.
Usage: abcde [options] [tracks]
Options:
-1     Encode the whole CD in a single file
-a <action1[,action2]...>
       Actions to perform:
       cddb,read,getalbumart,normalize,encode,tag,move,replaygain,playlist,clean
-b     Enable batch normalization
-c <file>
       Specify a configuration file (overrides system and user config files)
-C <discid#>
       Specify discid to resume from (only needed if you no longer have the cd)
-d <device>
       Specify CDROM device to grab (flac uses a single-track flac file)
-D     Debugging mode (equivalent to sh -x abcde)
-e     Erase encoded track information from status file
-f     Force operations that otherwise are considered harmful. Read "man abcde"
-g     Use "lame --nogap" for MP3 encoding. Disables low disk and pipes flags
-G     Get album art by using the 'getalbumart' action
-h     This help information
-j <#> Number of encoder processes to run at once (localhost)
-k     Keep the wav tracks for later use
-l     Use low disk space algorithm
-L     Use local CDDB storage directory
-m     Modify playlist to include CRLF endings, to comply with some players
-n     No lookup. Don't query CDDB, just create and use template
-N     Noninteractive. Never prompt for anything
-o <type1[,type2]...>
       Output file type(s) (vorbis,mp3,flac,spx,mpc,wav,m4a,opus,mka,wv,ape,mp2,tta). Defaults to vorbis
-p     Pad track numbers with 0's (if less than 10 tracks)
-P     Use UNIX pipes to read+encode without wav files
-r <host1[,host2]...>
       Also encode on these remote hosts
-s <field>
       Show fields from the CDDB info (year,genre)
-S <#> Set the CD speed
-t <#> Start the track numbering at a given number
-T <#> Same as -t but modifies tag numbering
-U     Do NOT use UNICODE (UTF8) tags and comments
-v     Show version number and exit
-V     Be a bit more verbose about what is happening behind the scenes
-x     Eject CD after all tracks are read
-w <comment>
       Add a comment to the CD tracks
-W <#> Concatenate CDs: -T #01 -w "CD #"
-z     Use debug CDROMREADERSYNTAX option (needs cdparanoia)
Tracks is a space-delimited list of tracks to grab.
Ranges specified with hyphens are allowed (i.e., 1-5).

以上


<参考>
・cdparanoia
< https://ja.wikipedia.org/wiki/Cdparanoia > 2020年4月21日

・Use abcde to produce high quality flac and mp3 output with album art under Xenial?
< https://askubuntu.com/questions/788327/use-abcde-to-produce-high-quality-flac-and-mp3-output-with-album-art-under-xenia > 2020年6月29日

・Renovated abcde guide...
<https://ubuntuforums.org/showthread.php?t=2257705  > 2020年7月23日

・How MP3 Files Work
<https://computer.howstuffworks.com/mp32.htm  >2020年6月29日

投げ銭

★当サイトへの投げ銭(PayPal)★

Ad

Ad