# Jellyfin avec transcodage matériel NVIDIA

1. [Installation de la boîte à outils NVIDIA Container](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installation)

2. Faire un point de montage d'un partage de stockage réseau sur l'hôte, si ce n'est pas un NAS, en modifiant le fichier `fstab` sur Debian ou Ubuntu serveur avec les commandes :
```bash
sudo -i
```
```bash
nano /etc/fstab
```
```bash
192.168.0.187:/mnt/media/multimedia /mnt/nas_multimedia/ nfs defaults,nofail 0 0
```
```bash
apt install -y nfs-common && systemctl daemon-reload && mkdir /mnt/nas_multimedia/ && mount -a
```
```bash
exit
```
3. Crée un volume pour le conteneur :
```bash
docker volume create jellyfin_config
```
```bash
docker volume create jellyfin_cache
```
4. Le docker compose :
```bash
services:
  jellyfin:
    image: 'linuxserver/jellyfin'
    container_name: 'Jellyfin'
    network_mode: 'bridge'
    restart: 'unless-stopped'
    hostname: 'Jellyfin'
    environment:
      TZ: 'Europe/Zurich'
      PUID: '0'
      PGID: '0'
      JELLYFIN_PublishedServerUrl: '0.0.0.0'
      NVIDIA_DRIVER_CAPABILITIES: 'all'
      NVIDIA_VISIBLE_DEVICES: 'all'
    deploy:
      resources:
        limits:
          cpus: '2.00'
          memory: '1024M'
        reservations:
          cpus: '0.02'
          memory: '256M'
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    volumes:
      - 'jellyfin_config:/config'
      - 'jellyfin_cache:/cache'
      - '/mnt/nas_multimedia/Films:/films'
      - '/mnt/nas_multimedia/Séries:/tv_shows'
    ports:
      - '8096:8096'
networks:
  jellyfin_network:
    driver: bridge
volumes:
  jellyfin_config:
    external: true
  jellyfin_cache:
    external: true
```
Voir les sessions d'encodage sur l'hôte :
```bash
nvidia-smi encodersessions
```
Pour voir l'utilisation en temps réel de façon globale de la carte graphique :
```bash
nvidia-smi dmon
```
Documentation : [https://hub.docker.com/r/linuxserver/jellyfin](https://hub.docker.com/r/linuxserver/jellyfin)