memories/docs/config.md

130 lines
6.6 KiB
Markdown
Raw Normal View History

---
description: Steps to configure Memories for the best experience and performance
---
# Configuration
!!! danger "Use the admin interface"
Starting with v5.0.0, you can fully configure memories using the admin panel. With an admin account in Nextcloud, go to `Settings -> Memories`.
Using the admin interface for configuration is **strongly recommended** in most cases.
Memories runs a background indexing job to extract EXIF metadata from photos and videos, as well as immediately on every upload.
If you just installed memories and want to speed up indexing, run the following commands. For usage of the `occ` command line, refer [here](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) for more information.
```bash
occ memories:places-setup # set up reverse geocoding, will force re-indexing
occ memories:index # index existing photo files (can run in parallel, refer to admin panel)
```
!!! warning "OCCWeb"
The OCCWeb app is deprecated, and will not work with Memories. You must use the `occ` command line.
!!! tip "Cron"
You **DO NOT** need to set up a cron job or run `occ memories:index` periodically, since this is handled internally.
Any subsequently uploaded files will be indexed automatically with hooks. In case you upload files externally and run
`files:scan`, the background job will index these files. Make sure Nextcloud cron is configured correctly.
!!! tip "OCC with Docker"
If you are using docker, make sure you run these commands with an interactive TTY. For example,
```bash
docker exec -it my_nc_container php occ memories:index
# ^^^ <-- this is required
```
## Storage support
The app can work with external storage for photos. Just set the mountpoint as the timeline directory.
- If you add any photos from outside Nextcloud, you must run the scan and index commands.
- Indexing may be slow, since all files must be downloaded from the storage.
!!! warning "Transcoding with external storage"
Video transcoding requires the entire file to be available locally for ffmpeg. To prevent downloading the
entire for every playback, transcoding is disabled for external storage.
## Image/Video support
To get support for all file types including HEIC, TIFF and RAW, refer to [this page](./file-types.md).
To enable support for high resolution images, you need to update Nextcloud's `config.php` to include
```php
'preview_max_memory' => 4096,
'preview_max_filesize_image' => 256,
```
## Transcoding
Memories bundles a [transcoding server](https://github.com/pulsejet/go-vod) with HLS capabilites for adaptive streaming. You need to configure transcoding to be able to play any videos. HLS enables the browser to download the video as small chunks and in resolutions adaptive to the connection speed. As a result, this is usually expected to have a major boost in video experience and performance.
You can configure transcoding from the admin panel. Make sure to test all settings carefully on different kinds of videos.
Read the following considerations carefully regarding transcoding:
1. In general, transcoding can be very compute intensive. If you run Nextcloud on an RPi, it will not work for you.
1. If you use external storage, transcoding might be very slow or not work at all. In this case, you should disable it.
1. Make sure there is a lot of space available in `/tmp` for the transcoded files.
1. If transcoding fails, the video player will fall back to the original video stream. Check the output of `/tmp/go-vod/<instanceid>.log`
1. For better performance, you may configure the transcoder to use hardware acceleration. See [this page](./hw-transcoding.md).
## Reverse geocoding
Memories supports reverse geocoding to find the location of photos. To set up geocoding you need to download the planet boundary dataset and store it in the database. This works only on MySQL/MariaDB/Postgres (no SQLite support). To set up, go to the admin panel. Note that all your files will be re-indexed after downloading the planet database.
## Recommended apps
- [Preview Generator](https://github.com/rullzer/previewgenerator) - For pre-generating image previews (**required** for best performance)
- [Recognize](https://github.com/nextcloud/recognize) - The official Nextcloud app for AI tagging of images and people.
- [Photos](https://github.com/nextcloud/photos) - The official Nextcloud Photos app, required for albums support.
- [Face Recognition](https://github.com/matiasdelellis/facerecognition) - An alternative face recognition app, which offers more fine-tuning. Alpha stage integration.
## Preview storage
By default, previews upto `4096px` size are generated by Nextcloud. Each of the largest previews might be a few megabytes in size. This may not be ideal if you have limited storage space, since the preview size may become larger than the originals (especially if you use efficient image formats like HEIC). In this case, you can limit previews to a smaller size like `2048px`.
Note that Memories will, by default, load the full image upon zooming in. If you are okay with this, you may use a even smaller size like `1024px` to save more space as well as faster preview generation time. Non-JPEG files will be converted on the server when loading in full-res, which may lead to some server load.
```php
'preview_max_x' => 2048,
'preview_max_y' => 2048,
```
You can also set the preview JPEG quality to 80 to save more space.
```bash
occ config:app:set preview jpeg_quality --value="80"
```
If you already generated previews and want to regenerate, run the following (at your own risk; have backups)
```bash
rm -rf <nextcloud-data-dir>/appdata_*/preview
occ files:scan-app-data
```
## Migration
Memories directly uses EXIF metadata from files, so migration should be generally easy. The file structure of your photos is preserved as-is.
If you are migrating from Nextcloud Photos, you don't need to do anything. Your albums and tags will be carried to Memories as-is.
If you are migrating from Google Takeout, you may run the following command to move JSON metadata to EXIF.
```bash
occ memories:migrate-google-takeout
```
## Other notes
- For optimal performance, enable HTTP/2 on your reverse proxy (nginx/apache)
- Make sure your server timezone is configured correctly. If a photo does not contain an EXIF date, the server time is used.
- Perform additional server tuning for Nextcloud. See [the docs](https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html).
- The archive feature moves photos to a separate folder called `.archive` at the root of your timeline. You can, for example, mount this folder to a cold storage.