やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Raspbian stretchでDVDをリッピングする

 悪戦苦闘。

対象環境

失敗(HandBrakeCLIインストールできず)

情報源

手順

sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install gdebi-core -y
cd /usr/local/bin
wget http://steinerdatenbank.de/software/ghb_0.10.5-1_armhf.deb
sudo gdebi ghb_0.10.5-1_armhf.deb

 なんか怒られたんですけど……。

$ sudo gdebi ghb_0.10.5-1_armhf.deb
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done
このパッケージはインストールできません
Dependency is not satisfiable: libavcodec56

 HandBrakeCLIはインストールすらできずに失敗。

成功(libdvdcss2(libdvd-pkg), dvdbackup, genisoimage

情報源

livdvdcss2でなくlibdvdcss2ね。これでハマった。

方法

  1. /etc/apt/sources.listに追記
  2. インストール

1. /etc/apt/sources.listに追記

$ sudo leafpad /etc/apt/sources.list
deb http://www.debian-multimedia.org stretch main non-free

2. インストール

 libdvdcss2(libdvd-pkg), dvdbackup, genisoimage

libdvdcss2(libdvd-pkg)

$ sudo apt-get install libdvdcss2
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
注意、'libdvdcss2' の代わりに 'libdvd-pkg' を選択します
以下の追加パッケージがインストールされます:
  autoconf automake autopoint autotools-dev debhelper dh-autoreconf
  dh-strip-nondeterminism gettext intltool-debian libarchive-zip-perl
  libfile-stripnondeterminism-perl libltdl-dev libmail-sendmail-perl
  libsigsegv2 libsys-hostname-long-perl libtool m4 po-debconf
提案パッケージ:
  autoconf-archive gnu-standards autoconf-doc dh-make gettext-doc
  libasprintf-dev libgettextpo-dev libtool-doc gfortran | fortran95-compiler
  gcj-jdk m4-doc libmail-box-perl
以下のパッケージが新たにインストールされます:
  autoconf automake autopoint autotools-dev debhelper dh-autoreconf
  dh-strip-nondeterminism gettext intltool-debian libarchive-zip-perl
  libdvd-pkg libfile-stripnondeterminism-perl libltdl-dev
  libmail-sendmail-perl libsigsegv2 libsys-hostname-long-perl libtool m4
  po-debconf
アップグレード: 0 個、新規インストール: 19 個、削除: 0 個、保留: 0 個。
5,355 kB のアーカイブを取得する必要があります。
この操作後に追加で 16.5 MB のディスク容量が消費されます。
続行しますか? [Y/n] 
パッケージの設定                                                              
                                                                              
                                                                              
  ┌────────────────────┤ libdvd-pkg を設定しています ├─────────────────────┐  
  │                                                                        │  
  │                                                                        │  
  │                                                                        │  
  │ This package automates the process of launching downloads of the       │  
  │ source files for libdvdcss2 from videolan.org, compiling them, and     │  
  │ installing the binary packages (libdvdcss2 libdvdcss-dev).             │  
  │                                                                        │  
  │ Please run "sudo dpkg-reconfigure libdvd-pkg" to launch this process   │  
  │ for the first time.                                                    │  
  │                                                                        │  
  │                                 <了解>                                 │  
  │                                                                        │  
  └────────────────────────────────────────────────────────────────────────┘  
                                                                                                                                                       

 以下Google翻訳

このパッケージは、ダウンロードを開始するプロセスを自動化します
videolan.orgのlibdvdcss2のソースファイルをコンパイルして、│
バイナリパッケージをインストールする(libdvdcss2 libdvdcss-dev)。 

このプロセスを起動するには "sudo dpkg-reconfigure libdvd-pkg"を実行してください初めて。
パッケージの設定                                                              
                                                                              
 ┌─────────────────────┤ libdvd-pkg を設定しています ├─────────────────────┐  
 │                                                                         │  
 │ If activated, the APT post-invoke hook takes care of future automatic   │  
 │ upgrades of libdvdcss2 (which may be triggered by new versions of       │  
 │ libdvd-pkg). When updates are available, the hook will launch the       │  
 │ process of downloading the source, recompiling it, and (if "apt-get     │  
 │ check" reports no errors) using "dpkg -i" to install the new versions.  │  
 │                                                                         │  
 │ Alternatively, the process can be launched manually by running "sudo    │  
 │ dpkg-reconfigure libdvd-pkg".                                           │  
 │                                                                         │  
 │ Enable automatic upgrades for libdvdcss2?                               │  
 │                                                                         │  
 │                    <はい>                      <いいえ>                 │  
 │                                                                         │  
 └─────────────────────────────────────────────────────────────────────────┘  
                                                                              
If activated, the APT post-invoke hook takes care of future automatic upgrades of libdvdcss2 (which may be triggered by new versions of libdvd-pkg).
When updates are available, the hook will launch the process of downloading the source, recompiling it, and (if "apt-get check" reports no errors) using "dpkg -i" to install the new versions.
                                                                            
Alternatively, the process can be launched manually by running "sudo dpkg-reconfigure libdvd-pkg".

Enable automatic upgrades for libdvdcss2?           
 起動された場合、APTポストインボークフックは将来libdvdcss2の自動アップグレードを行います(新しいバージョンのlibdvd-pkgによって起動される可能性があります)。
 アップデートが利用可能になると、フックはソースをダウンロードし、再コンパイルし、 "dpkg -i"を使って新しいバージョンをインストールする( "apt-get check"がエラーを報告しない場合)プロセスを起動します。
                                                                            
 別の方法として、 "sudo dpkg-reconfigure libdvd-pkg"を実行して手動でプロセスを起動することもできます。

 libdvdcss2の自動アップグレードを有効にしますか?
sudo dpkg-reconfigure libdvd-pkg
                                     
                                                                              
   ┌──────────┤ Download, build and install libdvdcss2/1.4.0-1 ├──────────┐   
   │                                                                      │   
   │ This package automates the process of launching downloads of the     │   
   │ source files for libdvdcss2 from videolan.org, compiling them, and   │   
   │ installing the binary packages (libdvdcss2 libdvdcss-dev).           │   
   │                                                                      │   
   │ Please confirm whether you wish this to happen.                      │   
   │                                                                      │   
   │ Download, build, and install libdvdcss2/1.4.0-1?                     │   
   │                                                                      │   
   │                   <はい>                     <いいえ>                │   
   │                                                                      │   
   └──────────────────────────────────────────────────────────────────────┘   
                                                                              
This package automates the process of launching downloads of the source files for libdvdcss2 from videolan.org, compiling them, and installing the binary packages (libdvdcss2 libdvdcss-dev).

Please confirm whether you wish this to happen.

Download, build, and install libdvdcss2/1.4.0-1?
このパッケージは、videolan.orgからlibdvdcss2用のソースファイルのダウンロードを起動し、コンパイルし、バイナリパッケージ(libdvdcss2 libdvdcss-dev)をインストールするプロセスを自動化します。

これが起こるかどうかを確認してください。

dvdbackup

 DVDからデータを取得する。

$ sudo apt-get install dvdbackup
$ dvdbackup --version
dvdbackup 0.4.2
...
$ dvdbackup -M -i /dev/DVDのデバイス -o ./

 DVDデバイス/dev/sr0なら以下。

$ dvdbackup -M -i /dev/sr0 -o ./

 DVDデータができる。15分/1枚 くらい。

$ dmesg | grep sr

genisoimage

$ sudo apt-get install genisoimage
$ genisoimage -dvd-video -udf -o 任意ファイル名.iso ./作成されたディレクトリ
$ genisoimage -dvd-video -udf -o "/home/pi/root/db/iso/media/animation/eva/Eve 1 Scn.iso" "/home/pi/root/db/iso/media/animation/eva/Eve 1 Scn"

genisoimage -dvd-video -udf -o "/home/pi/root/db/iso/media/movie/Titanic.iso" "/home/pi/root/db/iso/media/movie/Titanic Japan Asia"

 12分/1枚 くらいで完了。

3318042 extents written (6480 MB)

iso再生

 動画再生ソフトVLCで再生を確認する。

$ vlc --version
VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
...

 音声は聞こえたが、映像が静止画……。おそらくCPUやメモリ不足だろうが、ファイル破損の可能性も否定できない。

GPUメモリを増やす

  1. タスクバーのシステムアイコンをクリックする
  2. 設定にマウスオーバーする
  3. Raspberry Pi の設定をクリックする
  4. パフォーマンスタブをクリックする
  5. GPUメモリの値を256にする(デフォルトは64。最大896
    f:id:ytyaru:20181002174553p:plain
  6. OKボタンをクリックする
  7. 再起動する

 その後、VLCのウインドウサイズを小さくすると動画が再生された。(ウインドウサイズが大きいと静止画状態で音声のみ再生)

 たぶんGPUメモリをもっと増やせば大きく表示できる。(その分システムが使えるメモリ減るけど)