# Migration

## v2.4+ to v2.3.x (downgrade)

Restreamer version >= 2.4.0 switches to FFmpeg 5.1.2, which is incompatible with earlier versions.

However, if problems arise due to the update, there is a backup to downgrade to =< 2.3.x.

### The required steps:

{% tabs %}
{% tab title="Guide" %}

* Switch to the mounted Restreamer configuration folder\
  \&#xNAN;*Docker parameter: -v /host/path:/core/config*
* Rename **db.json** to **db\_ff5.json**&#x20;
* Rename **db\_ff4.json** to **db.json**
* Start the Restreamer container with an older Docker image tag (e.g., datarhei/restreamer:2.3.0.)
  {% endtab %}

{% tab title="Linux example" %}
{% code lineNumbers="true" %}

```bash
docker kill restreamer
docker rm restreamer
cd /mnt/restreamer/config
mv db.json db_ff5.json
mv db_ff4.json db.json
docker run {used params...} datarhei/restreamer:2.3.0
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Restoring the processes created with the new version >= 2.4.0, is impossible.
{% endhint %}

## v0.6.x to v2.x

If you are currently using an older version of Restreamer and want to upgrade to the latest version, you have to follow these steps. In case you don't need or want to keep your current stream settings you can go the [Quick Start](https://docs.datarhei.com/restreamer/getting-started/quick-start) page and install Restreamer v2.x from scratch.

This guide assumes that your current docker command line looks like

```
$ docker run -d --restart always \
     --name restreamer \
     -e "RS_USERNAME=admin" -e "RS_PASSWORD=datarhei" \
     -p 8080:8080 -v /mnt/restreamer/db:/restreamer/db \
     datarhei/restreamer:latest
```

Your actual command line might have more enviroment variables or different paths to the mounted directories.

1. Upgrade your Restreamer to v0.6.8 (<https://github.com/datarhei/restreamer/releases/tag/v0.6.8>). If you don't upgrade to v0.6.8, all your settings might get lost during the migration.
2. Start Restreamer v0.6.8 and start streaming from the video source.
3. Stop Restreamer v0.6.8 by stopping the Docker container, e.g. `docker kill restreamer` and then `docker rm restreamer`.
4. Pull the latest Restreamer image, e.g. `docker pull datarhei/restreamer:latest`.
5. Adjust the mounted volumes by replacing <mark style="color:red;">`-v /mnt/restreamer/db:/restreamer/db`</mark> with <mark style="color:green;">`-v /mnt/restreamer/db:/core/config -v /opt/restreamer/data:/core/data`</mark> in your docker command line.
6. Start Restreamer. Now the settings from v0.6.8 are imported to v2.x
7. Done.

Your docker command should now look like

```
$ docker run -d --restart always \
     --name restreamer \
     -e "RS_USERNAME=admin" -e "RS_PASSWORD=datarhei" \
     -p 8080:8080 \
     -v /mnt/restreamer/db:/core/config -v /opt/restreamer/data:/core/data \
     datarhei/restreamer:latest
```

After the old settings have been successfully imported, the old settings database (`v1.json`) stored in `/mnt/restreamer/db` will not be used anymore. A new settings database (`db.json`) and a config file (`config.json`) have been created in that directory.

### Review your Docker command line

In case you are using any [environment variables](https://datarhei.github.io/restreamer/docs/references-environment-vars.html) (command line options that start with `-e RS_`), they will be ignored after the first start of Restreamer v2.x (see step 6 above). You can remove them from your docker command line.

As in the example command line above, there are two environment variables `RS_USERNAME` and `RS_PASSWORD`. You can remove those because during the first start of Restreamer v2.x their values were transferred into the `config.json`.

Your docker command should now look like

```
$ docker run -d --restart always \
     --name restreamer \
     -p 8080:8080 \
     -v /mnt/restreamer/db:/core/config -v /opt/restreamer/data:/core/data \
     datarhei/restreamer:latest
```

Your actual command line might have different paths to the mounted directories. Please adjust the example above accordingly in case you want to copy/paste it.
