# LibreELEC (kodi) on Raspberry Pi

**URL:** https://forum.ficusonline.com/t/topic/491
**Category:** Raspberry Pi
**Created:** [2023 年 9 月 7 日午前 5:43 UTC](https://forum.ficusonline.com/t/topic/491 "2023-09-07T05:43:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2023 年 9 月 7 日午前 5:43 UTC](https://forum.ficusonline.com/t/topic/491/1 "2023-09-07T05:43:19Z")

</div>

Raspberry Piに **LibreELEC(kodi)** をインストールしてメディアサーバとして利用します。ImagerにはOSの選択肢としてLibreELECが含まれているため、ImagerでSDカードにOSを書き込みます。

**Media player OSを選択**

 ![Screenshot from 2023-09-07 13-40-38](https://forum.ficusonline.com/uploads/default/original/2X/0/0cec38092f5e398d170944af807d315f8b711d8b.png)

**LibreELECを選択**

 ![Screenshot from 2023-09-07 13-40-48](https://forum.ficusonline.com/uploads/default/original/2X/2/27094ec78324f0b9b244833589fad7078fd1f53b.png)

**Kodi wiki LibreELEC**  
[https://kodi.wiki/view/LibreELEC](https://kodi.wiki/view/LibreELEC)

**スマートフォンやタブレットから操作**  
[https://kodi.wiki/view/Smartphone/tablet\_remotes](https://kodi.wiki/view/Smartphone/tablet_remotes)

**ブラウザから操作**  
[https://kodi.wiki/view/Web\_interface](https://kodi.wiki/view/Web_interface)

### 起動条件：config.txtの編集

3.5mmオーディオジャック出力、HDMI出力、各種I/Oなどの機能を有効にするためには、ブートフォルダに格納されているconfig.txtファイルに各種パラメータを追加する必要があります。

config.txtファイルの編集は以下の手順で行います。

> **[Config.txt | LibreELEC.wiki](https://wiki.libreelec.tv/configuration/config_txt)**

**SSH接続からconfig.txtの編集、リブートまでの流れ**

```auto
$ ssh root@192.168.xx.xx
root@192.168.xx.xx's password: 
##############################################
# LibreELEC #
# https://libreelec.tv #
##############################################

LibreELEC (official): 11.0.3 (RPi2.arm)

# cd /flash
# mount -o remount,rw /flash
# nano /flash/config.txt
# mount -o remount,ro /flash
# reboot

```

**3.5mmオーディオジャック**

> **[Rpi4 Libreelec 10.0.1 no sound through Pi's audio jack or Bluetooth -...](https://forum.libreelec.tv/thread/25259-rpi4-libreelec-10-0-1-no-sound-through-pi-s-audio-jack-or-bluetooth/)**
>
> Raspberry Pi 4 arm: LibreELEC 10.0.1 KODI
> 
> My HDMI monitor doe not have speakers connected.
> 
> I have a portable speaker plugged into the Raspberry Pi's stereo jack; but no sound.
> 
> I also tried connecting a Blue Tooth Headset that does show up as…

> `dtparam=audio=on`

**HDMI**  
[https://forums.raspberrypi.com/viewtopic.php?t=5062](https://forums.raspberrypi.com/viewtopic.php?t=5062)

> `hdmi_force_edid_audio=1`

**config.txtの詳細については以下参照**  
[https://www.raspberrypi.com/documentation/computers/config\_txt.html](https://www.raspberrypi.com/documentation/computers/config_txt.html)

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2023 年 9 月 7 日午前 8:52 UTC](https://forum.ficusonline.com/t/topic/491/2 "2023-09-07T08:52:35Z")

</div>

## LibreELEC YouTube add-on

以下GCP内での作業です。

LIbreELECでYouTubeを再生するためには、APIライブラリから提供されているYouTube DATA APIを利用します。

**APIライブラリ**  
[Google Cloud console](https://console.cloud.google.com/apis/library)

**YouTube DATA API**

 ![enable-youtube-api](https://forum.ficusonline.com/uploads/default/original/2X/f/f5494109ecdbe57e2f09c67146886d20c273959a.png)

> 既存のプロジェクトを選択するか、新たにこのAPI専用のプロジェクトを作成します。

 ![gcp-project](https://forum.ficusonline.com/uploads/default/original/2X/0/053ae555762c2db1a6ec38923fdc08b9f0d7fc9e.png)

 ![new-project](https://forum.ficusonline.com/uploads/default/original/2X/f/f1883c71f42e10e01c0cb31073258504d86a53e0.png)

> **`Credentials`** から **`API key`** を作成

 ![create-credentials](https://forum.ficusonline.com/uploads/default/original/2X/e/e988c5188533f98cb3a89c903e314f3cfac90c19.png)

> APIキーの制限条件を **`YouTube DATA API`** のみとします。

 ![api-restriction](https://forum.ficusonline.com/uploads/default/original/2X/9/9badcff6c5cabd5310403de490db1b6abe880f6c.png)

> **`OAuth consent screen`** を作成します。APIを利用できる **ユーザタイプは外部** とします。

 ![oauth-consent](https://forum.ficusonline.com/uploads/default/original/2X/a/ab5431750de45acd0b5bbac3b523e8bf1057ae62.png)

> APIを利用できる **Googleユーザを追加**  
> ユーザはGmailアカウント：xxxx@gmail.com

 ![oauth-add-user](https://forum.ficusonline.com/uploads/default/original/2X/c/c6d1b325d1e800f5c9abf3e582282ff72f97c3e3.png)

> 再び **`Credentials`** に戻り **`OAuth Client ID`** を作成

 ![oauth-client](https://forum.ficusonline.com/uploads/default/original/2X/5/58e54a2591a5b50c3b4ff442dd42ed73bf3b3a83.png)

> アプリケーションタイプと名称を入力して作成

 ![create-oauth-client](https://forum.ficusonline.com/uploads/default/original/2X/6/6dd6bed4bd6b480f2aa28da21da213c8743b5755.png)

> LibreELECのYouTubeアドオンで必要なのは **`API Key, Client ID, Client Secret`** です。

---

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2023 年 9 月 8 日午後 1:33 UTC](https://forum.ficusonline.com/t/topic/491/3 "2023-09-08T13:33:30Z")

</div>

### WireGuardの利用

> **[WireGuard | LibreELEC.wiki](https://wiki.libreelec.tv/configuration/wireguard)**

海外コンテンツを視聴するためにWIreGuardによるVPNを利用します。WireGuardによるVPNサーバはAWS, GCP, Azureなどのクラウドサービスを利用することで安価（1年間無料サービスもあり）に構築できます。有料で他の多くのユーザと帯域をシェアする海外のVPNサービスを契約する必要はありません。

LIbreELECには[ConnMan](https://wiki.archlinux.jp/index.php/ConnMan)というネットワークマネージャが予め導入されており、これを利用してLibreELECとWireGuardによるVPNサーバとの接続を確立します。

ローカルネットワーク内の任意のマシンからSSHでLibreELECに接続し、ConnManの記述型式に則ったWireGuardクライアント設定ファイル **`/storage/.config/wireguard/wg0.config`** を作成します。

```auto
$ ssh root@192.168.xx.xx
# nano /storage/.config/wireguard/wg0.config
[provider_wireguard]
Type = WireGuard
Name = WireGuard (Home)
Host = 185.210.30.121
WireGuard.Address = 10.2.0.2/24
WireGuard.ListenPort = 51820
WireGuard.PrivateKey = qKIj010hDdWSjQQyVCnEgthLXusBgm3I6HWrJUaJymc=
WireGuard.PublicKey = zzqUfWGIil6QxrAGz77HE5BGUEdD2PgHYnCg3CDKagE=
WireGuard.PresharedKey = DfEYeVs04HS9XhKGM4/ZXHG3Qc4MFK2AJd8XouYDbRQ=
WireGuard.DNS = 8.8.8.8, 1.1.1.1
WireGuard.AllowedIPs = 0.0.0.0/0
WireGuard.EndpointPort = 51820
WireGuard.PersistentKeepalive = 25

```

ConnManによるネットワークサービスの確認

```auto
# connmanctl services
* R home vpn_185_210_30_121
*AO Wired ethernet_dca622135939_cable

```

上記リストからvpn\_185\_210\_30\_121へ接続

```auto
# connmanctl connect vpn_185_210_30_121

```

pingコマンド

```auto
# ping 10.2.0.1
PING 10.2.0.1 (10.2.0.1): 56 data bytes
64 bytes from 10.2.0.1: seq=0 ttl=64 time=147.936 ms
64 bytes from 10.2.0.1: seq=1 ttl=64 time=147.955 ms

```

接続解除

```auto
# connmanctl disconnect vpn_185_210_30_121

```

接続が確立されない場合は、一度LibreELECマシンを再起動して下さい。
