跳到主要内容

相册-前期调研

案例:lychee(优先)

界面

Lychee是这三个相册应用中功能最简单的一个,也很容易上手,它的主页如下图

主页主页

官方介绍的功能有上传,照片exif信息查看,文件操作,分享:

上传功能界面上传功能界面

Exif显示界面Exif显示界面

文件操作界面文件操作界面

分享界面分享界面

案例

https://www.cnblogs.com/cuianbing/p/16287940.html

案例

https://post.smzdm.com/p/apze0pl7/

安装问题:env。。。

卡顿:2k-3k照片时

PhotoPrism

界面

最后一个是photoprism, 它也是一个强大的图床应用(不支持中文),依赖于google的机器学习成果, 它能够对图片进行目标识别(不包括人脸,失望ing),再进行分类,标记图片。食物,动物,汽车等常见的物体都能很好的进行分类,国内特色食物除外。。。

主页示例主页示例

面这张图是我自己的相册分类,有82个标签类型,当然有好多不准确的。。。。

Nas相册大乱斗,成年人没有选择题,我全都要

Piwigo中的时间分类和地图钉的功能在photoprism中都有,时间分类的功能比较简单,只能支持到年,地图钉的功能比piwigo的好用,能够在地图上显示大面积的预览图

Nas相册大乱斗,成年人没有选择题,我全都要

Nas相册大乱斗,成年人没有选择题,我全都要

在photoprism下的每一张图片都可能有多个标签,有的是图片自带的exif信息,比如gps信息,相机型号,曝光度等等,有的是photoprism对图片的识别标签,用户可以用这些标签对图片进行分类浏览,比如下图中的国家分类,相机型号分类,在search栏可以输入自己想找的图片包含的任一种信息,比如后面一张查找绿色的图片,这个就很方便找图片。

图片分类检索图片分类检索

按颜色检索按颜色检索

下面是它的设置界面,我没去研究,都是默认的设置:

设置界面设置界面

p

hotoprism在进行图片分类的时候,cpu是拉满的,我的4000多张图片大概要跑几个小时,图片分好类后就正常使用了。

Nas相册大乱斗,成年人没有选择题,我全都要

第一次写文章,可能用点乱,大家将就看。

案例

https://zhuanlan.zhihu.com/p/639392818

https://www.baidu.com/link?url=dfxNxfZtfMZilrypjObtbGVnRZJ4JNcxmPpUne_MYrROJremGrUaraeh3wMuxyv2&wd=&eqid=e26df1480004263e0000000465703125

案例:知乎

https://zhuanlan.zhihu.com/p/438779525

其它

啊这

不支持多用户

对比

开始部署

官网==(github star 30.3k)==

GitHub地址:https://github.com/photoprism/photoprism/

官网地址:https://docs.photoprism.org/

img

  • github start:30.3k

需求

开始部署

效果

人脸功能

自动打标签

文件夹方式

网页远程

首页远程

安装winodws docker-desktop

参考文档

https://yeasy.gitbook.io/docker_practice/install/windows#zai-wsl2-yun-hang-docker

docker-compose

curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
#下载docker-compose文件
#如果local下面没有bin文件夹就创建一个,或者放到别的地方也行

chmod +x /usr/local/bin/docker-compose
#给他一个执行权限


[root@docker ~]#docker-compose --version
Docker Compose version v2.23.0
#创建一个文件夹
mkdir /home/photoprism
cd /home/photoprism
#下载配置文件
wget https://dl.photoprism.app/docker/docker-compose.yml
version: '3.5'

# Example Docker Compose config file for PhotoPrism (Linux / AMD64)
#
# Note:
# - Running PhotoPrism on a server with less than 4 GB of swap space or setting a memory/swap limit can cause unexpected
# restarts ("crashes"), for example, when the indexer temporarily needs more memory to process large files.
# - If you install PhotoPrism on a public server outside your home network, please always run it behind a secure
# HTTPS reverse proxy such as Traefik or Caddy. Your files and passwords will otherwise be transmitted
# in clear text and can be intercepted by anyone, including your provider, hackers, and governments:
# https://docs.photoprism.app/getting-started/proxies/traefik/
#
# Setup Guides:
# - https://docs.photoprism.app/getting-started/docker-compose/
# - https://docs.photoprism.app/getting-started/raspberry-pi/
# - https://www.photoprism.app/kb/activation
#
# Troubleshooting Checklists:
# - https://docs.photoprism.app/getting-started/troubleshooting/
# - https://docs.photoprism.app/getting-started/troubleshooting/docker/
# - https://docs.photoprism.app/getting-started/troubleshooting/mariadb/
#
# CLI Commands:
# - https://docs.photoprism.app/getting-started/docker-compose/#command-line-interface
#
# All commands may have to be prefixed with "sudo" when not running as root.
# This will point the home directory shortcut ~ to /root in volume mounts.

services:
photoprism:
### Use photoprism/photoprism:preview for testing preview builds:
image: photoprism/photoprism:latest
### Don't enable automatic restarts until PhotoPrism has been properly configured and tested!
### If the service gets stuck in a restart loop, this points to a memory, filesystem, network, or database issue:
### https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors
# restart: unless-stopped
stop_grace_period: 10s
depends_on:
- mariadb
security_opt:
- seccomp:unconfined
- apparmor:unconfined
ports:
- "2342:2342" # HTTP port (host:container)
environment:
PHOTOPRISM_ADMIN_USER: "admin" # admin login username
PHOTOPRISM_ADMIN_PASSWORD: "insecure" # initial admin password (8-72 characters)
PHOTOPRISM_AUTH_MODE: "password" # authentication mode (public, password)
PHOTOPRISM_SITE_URL: "http://localhost:2342/" # server URL in the format "http(s)://domain.name(:port)/(path)"
PHOTOPRISM_DISABLE_TLS: "false" # disables HTTPS/TLS even if the site URL starts with https:// and a certificate is available
PHOTOPRISM_DEFAULT_TLS: "true" # defaults to a self-signed HTTPS/TLS certificate if no other certificate is available
PHOTOPRISM_ORIGINALS_LIMIT: 5000 # file size limit for originals in MB (increase for high-res video)
PHOTOPRISM_HTTP_COMPRESSION: "gzip" # improves transfer speed and bandwidth utilization (none or gzip)
PHOTOPRISM_LOG_LEVEL: "info" # log level: trace, debug, info, warning, error, fatal, or panic
PHOTOPRISM_READONLY: "false" # do not modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # disables updating storage permissions via chmod and chown on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # disables settings UI and API
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # disables all features depending on TensorFlow
PHOTOPRISM_DISABLE_FACES: "false" # disables face detection and recognition (requires TensorFlow)
PHOTOPRISM_DISABLE_CLASSIFICATION: "false" # disables image classification (requires TensorFlow)
PHOTOPRISM_DISABLE_VECTORS: "false" # disables vector graphics support
PHOTOPRISM_DISABLE_RAW: "false" # disables indexing and conversion of RAW images
PHOTOPRISM_RAW_PRESETS: "false" # enables applying user presets when converting RAW images (reduces performance)
PHOTOPRISM_JPEG_QUALITY: 85 # a higher value increases the quality and file size of JPEG images and thumbnails (25-100)
PHOTOPRISM_DETECT_NSFW: "false" # automatically flags photos as private that MAY be offensive (requires TensorFlow)
PHOTOPRISM_UPLOAD_NSFW: "true" # allows uploads that MAY be offensive (no effect without TensorFlow)
# PHOTOPRISM_DATABASE_DRIVER: "sqlite" # SQLite is an embedded database that doesn't require a server
PHOTOPRISM_DATABASE_DRIVER: "mysql" # use MariaDB 10.5+ or MySQL 8+ instead of SQLite for improved performance
PHOTOPRISM_DATABASE_SERVER: "mariadb:3306" # MariaDB or MySQL database server (hostname:port)
PHOTOPRISM_DATABASE_NAME: "photoprism" # MariaDB or MySQL database schema name
PHOTOPRISM_DATABASE_USER: "photoprism" # MariaDB or MySQL database user name
PHOTOPRISM_DATABASE_PASSWORD: "insecure" # MariaDB or MySQL database user password
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: "" # meta site description
PHOTOPRISM_SITE_AUTHOR: "" # meta site author
### Video Transcoding (https://docs.photoprism.app/getting-started/advanced/transcoding/):
# PHOTOPRISM_FFMPEG_ENCODER: "software" # H.264/AVC encoder (software, intel, nvidia, apple, raspberry, or vaapi)
# PHOTOPRISM_FFMPEG_SIZE: "1920" # video size limit in pixels (720-7680) (default: 3840)
# PHOTOPRISM_FFMPEG_BITRATE: "32" # video bitrate limit in Mbit/s (default: 50)
### Run/install on first startup (options: update https gpu tensorflow davfs clitools clean):
# PHOTOPRISM_INIT: "https gpu tensorflow"
### Run as a non-root user after initialization (supported: 0, 33, 50-99, 500-600, and 900-1200):
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
# PHOTOPRISM_UMASK: 0000
### Start as non-root user before initialization (supported: 0, 33, 50-99, 500-600, and 900-1200):
# user: "1000:1000"
### Share hardware devices with FFmpeg and TensorFlow (optional):
# devices:
# - "/dev/dri:/dev/dri" # Intel QSV
# - "/dev/nvidia0:/dev/nvidia0" # Nvidia CUDA
# - "/dev/nvidiactl:/dev/nvidiactl"
# - "/dev/nvidia-modeset:/dev/nvidia-modeset"
# - "/dev/nvidia-nvswitchctl:/dev/nvidia-nvswitchctl"
# - "/dev/nvidia-uvm:/dev/nvidia-uvm"
# - "/dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools"
# - "/dev/video11:/dev/video11" # Video4Linux Video Encode Device (h264_v4l2m2m)
working_dir: "/photoprism" # do not change or remove
### Storage Folders: "~" is a shortcut for your home directory, "." for the current directory
volumes:
# "/host/folder:/photoprism/folder" # Example
- "~/Pictures:/photoprism/originals" # Original media files (DO NOT REMOVE)
# - "/example/family:/photoprism/originals/family" # *Additional* media folders can be mounted like this
# - "~/Import:/photoprism/import" # *Optional* base folder from which files can be imported to originals
- "./storage:/photoprism/storage" # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE)

### Database Server (recommended)
### see https://docs.photoprism.app/getting-started/faq/#should-i-use-sqlite-mariadb-or-mysql
mariadb:
image: mariadb:10.11
### If MariaDB gets stuck in a restart loop, this points to a memory or filesystem issue:
### https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors
restart: unless-stopped
stop_grace_period: 5s
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
### Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
volumes:
- "./database:/var/lib/mysql" # DO NOT REMOVE
environment:
MARIADB_AUTO_UPGRADE: "1"
MARIADB_INITDB_SKIP_TZINFO: "1"
MARIADB_DATABASE: "photoprism"
MARIADB_USER: "photoprism"
MARIADB_PASSWORD: "insecure"
MARIADB_ROOT_PASSWORD: "insecure"

### Watchtower upgrades services automatically (optional)
### see https://docs.photoprism.app/getting-started/updates/#watchtower
### activate via "COMPOSE_PROFILES=update docker compose up -d"
watchtower:
restart: unless-stopped
image: containrrr/watchtower
profiles: ["update"]
environment:
WATCHTOWER_CLEANUP: "true"
WATCHTOWER_POLL_INTERVAL: 7200 # checks for updates every two hours
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "~/.docker/config.json:/config.json" # optional, for authentication if you have a Docker Hub account

奇怪现象

自己在本地虚拟机部署好PhotoPrism,都运行正常。但是在自己的ecs部署后,运行一会儿就报错了。

估计还是自己的ecs配置太小了;

  • 报错现象

可以看到photoprism-photoprism-1容器退出运行状态了。

  • 查看日志:
[root@hg-ecs2 高圆圆-好看照片]# docker logs -f photoprism-photoprism-1
started as root
running as root
photoprism start
time="2023-12-10T09:46:50Z" level=info msg="Help us make a difference and become a sponsor today!"
time="2023-12-10T09:46:50Z" level=info msg="Visit https://docs.photoprism.app/funding/ to learn more."
time="2023-12-10T09:46:50Z" level=info msg="config: make sure your server has enough swap configured to prevent restarts when there are memory usage spikes"
time="2023-12-10T09:47:00Z" level=info msg="migrate: 20211121-094727 successful [2.082703ms]"
time="2023-12-10T09:47:00Z" level=info msg="migrate: 20211124-120008 successful [2.201984ms]"
time="2023-12-10T09:47:02Z" level=info msg="http: enabling gzip compression"
time="2023-12-10T09:47:02Z" level=info msg="webdav: /originals/ enabled, waiting for requests"
time="2023-12-10T09:47:02Z" level=info msg="webdav: /import/ enabled, waiting for requests"
time="2023-12-10T09:47:02Z" level=info msg="http: starting web server at 0.0.0.0:2342"
time="2023-12-10T09:47:30Z" level=info msg="photos: found 0 results for public:true dist:20 year:0 month:0 quality:3 count:60 order:newest merged:true [1.521287ms]"
time="2023-12-10T09:47:52Z" level=info msg="设置已保存"
time="2023-12-10T09:47:55Z" level=info msg="设置已保存"
time="2023-12-10T09:49:09Z" level=info msg="设置已保存"
time="2023-12-10T09:49:09Z" level=info msg="folder: added album 高圆圆-好看照片 (path:\"高圆圆-好看照片\" public:true)"
time="2023-12-10T09:49:11Z" level=info msg="索引原始文件..."
time="2023-12-10T09:49:11Z" level=info msg="classify: loading nasnet"
time="2023-12-10T09:49:15Z" level=info msg="classify: loading labels from labels.txt"
time="2023-12-10T09:49:15Z" level=info msg="index: found no .ppignore file"
time="2023-12-10T09:49:15Z" level=info msg="index: added folder /"
time="2023-12-10T09:49:15Z" level=info msg="png: converting 高圆圆-好看照片/2.png to jpg"
time="2023-12-10T09:49:15Z" level=warning msg="metadata: no exif data in 2.png (parse png)"
time="2023-12-10T09:49:15Z" level=info msg="png: created 2.png.jpg [63.498019ms]"
time="2023-12-10T09:49:15Z" level=info msg="media: created 11 thumbnails for 2 [182.190617ms]"
time="2023-12-10T09:49:15Z" level=info msg="media: 2.png was taken at 2023-12-09 01:45:05 +0000 UTC (file mod time)"
time="2023-12-10T09:49:15Z" level=info msg="index: added main png file 高圆圆-好看照片/2.png"
time="2023-12-10T09:49:15Z" level=info msg="faces: loading facenet"
time="2023-12-10T09:49:18Z" level=info msg="index: found 1 face in 2.png.jpg [2.677714042s]"
time="2023-12-10T09:49:18Z" level=info msg="media: 2.png.jpg was taken at 2023-12-10 09:49:15.337595626 +0000 UTC (file mod time)"
time="2023-12-10T09:49:22Z" level=info msg="index: added related jpg file 2.png.jpg"
time="2023-12-10T09:49:24Z" level=info msg="media: 3.jpg was taken at 2023-12-09 01:45:06 +0000 UTC (file mod time)"
/entrypoint.sh: line 94: 8 Killed "$@"
[root@hg-ecs2 高圆圆-好看照片]#




[root@hg-ecs2 高圆圆-好看照片]# docker logs -f photoprism-mariadb-1
2023-12-10 09:46:44+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.6+maria~ubu2204 started.
2023-12-10 09:46:44+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-12-10 09:46:44+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.6+maria~ubu2204 started.
2023-12-10 09:46:44+00:00 [Note] [Entrypoint]: Initializing database files
2023-12-10 9:46:45 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOSYS: check seccomp filters, and the kernel version (newer than 5.1 required)
2023-12-10 9:46:45 0 [Warning] InnoDB: liburing disabled: falling back to innodb_use_native_aio=OFF



2023-12-10 09:46:48+00:00 [Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation)

2023-12-10 09:46:48+00:00 [Note] [Entrypoint]: Stopping temporary server
2023-12-10 9:46:48 0 [Note] mariadbd (initiated by: unknown): Normal shutdown
2023-12-10 9:46:48 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-10 9:46:48 0 [Note] InnoDB: Starting shutdown...
2023-12-10 9:46:48 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2023-12-10 9:46:48 0 [Note] InnoDB: Buffer pool(s) dump completed at 231210 9:46:48
2023-12-10 9:46:48 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2023-12-10 9:46:48 0 [Note] InnoDB: Shutdown completed; log sequence number 47108; transaction id 15
2023-12-10 9:46:48 0 [Note] mariadbd: Shutdown complete

2023-12-10 09:46:48+00:00 [Note] [Entrypoint]: Temporary server stopped

2023-12-10 09:46:48+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up.

2023-12-10 9:46:48 0 [Note] Starting MariaDB 10.11.6-MariaDB-1:10.11.6+maria~ubu2204 source revision fecd78b83785d5ae96f2c6ff340375be803cd299 as process 1
2023-12-10 9:46:48 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-12-10 9:46:48 0 [Note] InnoDB: Using transactional memory
2023-12-10 9:46:48 0 [Note] InnoDB: Number of transaction pools: 1
2023-12-10 9:46:48 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2023-12-10 9:46:48 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2023-12-10 9:46:48 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOSYS: check seccomp filters, and the kernel version (newer than 5.1 required)
2023-12-10 9:46:48 0 [Warning] InnoDB: liburing disabled: falling back to innodb_use_native_aio=OFF
2023-12-10 9:46:48 0 [Note] InnoDB: Initializing buffer pool, total size = 512.000MiB, chunk size = 8.000MiB
2023-12-10 9:46:48 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-10 9:46:48 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2023-12-10 9:46:48 0 [Note] InnoDB: End of log at LSN=47108
2023-12-10 9:46:49 0 [Note] InnoDB: 128 rollback segments are active.
2023-12-10 9:46:49 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2023-12-10 9:46:49 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2023-12-10 9:46:49 0 [Note] InnoDB: log sequence number 47108; transaction id 16
2023-12-10 9:46:49 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-12-10 9:46:49 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-10 9:46:49 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2023-12-10 9:46:49 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-12-10 9:46:49 0 [Note] Server socket created on IP: '::'.
2023-12-10 9:46:49 0 [Note] InnoDB: Buffer pool(s) load completed at 231210 9:46:49
2023-12-10 9:46:49 0 [Note] mariadbd: ready for connections.
Version: '10.11.6-MariaDB-1:10.11.6+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
2023-12-10 9:49:33 3 [Warning] Aborted connection 3 to db: 'photoprism' user: 'photoprism' host: '172.18.0.3' (Got an error reading communication packets)

  • 自己本地虚机都是正常运行的

  • 来看下两者的配置大小

本地虚机:

2c 2g

ecs:

2c 2g

  • 那就奇怪了……

😥

  • 再次启动刚才失败的那个容器,后续继续观察看看

问题:PhotoPrism支持相册分享功能不?-2023.12.11(已解决)

  • 提出问题

当然,PhotoPrism相册已经很不错了,但不知道它支持私密相册功能不?支持相册分享功能不(不登录相册,大家都可以访问相册里的内容)

这个自己后面再看看。

我们来测试看看:

  • 这里有私人的选项:

  • 我可以把这个相册公开分享出去吗?

  • 哦,看起来可以公开分享哦:

http://onedayxyy.cn:2342/s/2mdaeinvq5/gao-yuan-yuan

  • 支持分享时长

  • 我们可以看到,之前未分享时,相册这里是没分享标识的:

  • 分享相册后,这里就会出现一个分享标识的:

  • 来测试下效果:

http://onedayxyy.cn:2342/s/2mdaeinvq5/gao-yuan-yuan

清空浏览器缓存,重新打开浏览器:

完美。😘

  • 这里要想关闭分享的话,就点击这里关闭分享就好:

问题:PhotoPrism里,如果相册目录有嵌套,应该也会正常识别的吧?-2023.12.11(已解决)

  • 问题

PhotoPrism里,如果相册目录有嵌套,应该也会正常识别的吧?

  • 当前现状

可以看到,本地有2个目录,都是高圆圆目录,现在我想把这2个目录给放到一个目录里去,我们看看会出现什么效果呢?

现在我想把这2个目录给放到一个目录里去,在ecs底层移动目录:

[root@hg-ecs-docusaurus-wiki photos]# mkdir 高圆圆
[root@hg-ecs-docusaurus-wiki photos]# mv 高圆圆-好看照片/ 2011年Olay代言活动高清大图/ 高圆圆
[root@hg-ecs-docusaurus-wiki photos]# ls 高圆圆/
2011年Olay代言活动高清大图 高圆圆-好看照片
[root@hg-ecs-docusaurus-wiki photos]#
  • 可以看到

这里还是和之前一样的,PhotoPrism依旧会按目录为单位进行索引数据的(只要某个目录里含有照片的话,那么就会被识别成一个相册)!nice😘

  • 那么我就就可以创建其它一些分类照片了哦。
[root@hg-ecs-docusaurus-wiki photos]# ls
家人 摄影 自己 那份爱恋 高圆圆
[root@hg-ecs-docusaurus-wiki photos]# ls 家人/
外婆外公 爷爷奶奶 爸爸妈妈
[root@hg-ecs-docusaurus-wiki photos]# ls 那份爱恋/
佳 彦
[root@hg-ecs-docusaurus-wiki photos]# ls 摄影/
动物 风景

注意:PhotoPrism不识别音频-2023.12.11

[root@hg-ecs-docusaurus-wiki photos]# ls /images/*.mp3
/images/佳-表白录音.mp3
[root@hg-ecs-docusaurus-wiki photos]# cp /images/佳-表白录音.mp3 music/
[root@hg-ecs-docusaurus-wiki photos]# ls
music video 家人 摄影 自己 那份爱恋 高圆圆
[root@hg-ecs-docusaurus-wiki photos]# ls music/
佳-表白录音.mp3
[root@hg-ecs-docusaurus-wiki photos]#

  • 是个小遗憾

  • gpt

提出问题

那么,这个需求就来了哦

有什么比较推荐的音频和视频播放库吗,最好能使用docker部署?

gpt

2023年12月11日 gpt

有什么比较推荐的音频和视频播放库吗,最好能使用docker部署?

有一些流行且广泛使用的音频和视频播放库,其中一些可以轻松地使用 Docker 部署。以下是一些推荐的库:

  1. Jellyfin:
    • 描述: Jellyfin 是一款用于管理和播放媒体文件的开源媒体服务器。它支持音频、视频和图像,并提供一个用户友好的界面。
    • Docker: Jellyfin 提供了官方的 Docker 镜像,使其在 Docker 环境中易于部署。
  2. Plex:
    • 描述: Plex 是一款流行的媒体服务器,支持音频、视频和图像,并提供了强大的媒体库管理功能。
    • Docker: Plex 也有官方的 Docker 镜像,可以通过 Docker 运行 Plex 服务器。
  3. Emby:
    • 描述: Emby 是一款媒体服务器,提供音频、视频和图像的流媒体服务,同时具有一些高级功能,如实时转码和用户权限控制。
    • Docker: Emby 同样提供了 Docker 支持,可以通过 Docker 镜像轻松部署。
  4. Kodi (可配合服务端如KodiHeadless使用):
    • 描述: Kodi 是一款开源的媒体中心软件,可以通过插件和服务端进行音频和视频流媒体播放。
    • Docker: Kodi Headless 是一个专为服务器设计的 Kodi 版本,也可以通过 Docker 进行部署。
  5. Minio (用于对象存储):
    • 描述: Minio 是一款开源的对象存储服务器,可以用于存储和管理音频、视频等媒体文件。虽然不是播放库,但可以与其他媒体服务器一起使用,提供对象存储支持。
    • Docker: Minio 提供了 Docker 镜像,使其在容器环境中易于部署。

请注意,这些库可能有不同的特性和适用场景。选择其中一个取决于你的需求和偏好。在部署之前,请查阅相关文档以获取详细的安装和配置说明。


以上推荐使用哪个呢?

选择哪个媒体服务器取决于你的具体需求和个人偏好。以下是一些考虑因素:

  1. Jellyfin:
    • 优势: 完全开源,无需付费订阅,具有用户友好的界面。支持多平台。
    • 考虑: 可能在某些方面缺少一些 Plex 的高级功能,但它正在不断发展。
  2. Plex:
    • 优势: 具有强大的媒体库管理功能,对于实时转码和广泛的设备支持表现出色。有一个免费版本和一个付费的 Plex Pass 版本。
    • 考虑: 有些高级功能可能需要 Plex Pass 订阅。部分用户可能对其封闭源代码模型有所保留。
  3. Emby:
    • 优势: 提供强大的用户权限控制和实时转码功能。支持多平台。
    • 考虑: 类似于 Plex,一些高级功能可能需要订阅。
  4. Kodi (与KodiHeadless一起使用):
    • 优势: Kodi 是一款灵活且可定制的媒体中心软件,KodiHeadless 版本专为服务器设计。
    • 考虑: 它可能需要更多的手动配置,并不像其他专注于媒体服务器的解决方案那样易于使用。
  5. Minio (用于对象存储):
    • 优势: 提供对象存储功能,适用于大规模存储需求。轻量级且易于部署。
    • 考虑: 不是一个传统的媒体服务器,需要与其他媒体服务器配合使用。

建议你根据以下方面考虑做出决定:

  • 功能需求: 是否需要高级功能,如实时转码、用户权限控制等?
  • 开源与商业: 你更倾向于开源软件还是商业软件?
  • 用户界面: 是否需要一个用户友好的界面?
  • 设备兼容性: 你计划在哪些设备上观看媒体?
  • 社区和文档支持: 社区支持和文档是否充分,以便解决问题和获得支持?

根据这些因素,选择适合你需求和偏好的媒体服务器。在尝试之前,查看它们的文档和社区支持,以确保你可以得到所需的帮助和支持。

利用nginx?

利用百度网盘?

Plex

案例

https://blog.csdn.net/weixin_45565886/article/details/133966975

案例

https://baijiahao.baidu.com/s?id=1777339017575551647&wfr=spider&for=pc

使用

注意:PhotoPrism支持识别视频,但是播放速度贼卡。。。(丢弃视频存放功能)

2023年12月12日

  • 结论

PhotoPrism只存放照片,视频、音频不使用次方案存放!

  • 测试
[root@docusaurus-wiki photos]# ls
gif videos 家人 摄影 自己 那份爱恋 高圆圆
[root@docusaurus-wiki photos]# ls videos/
佳-表白录音.mp3 日照金山.mp4

  • 但是,播放速度贼卡:。。。

待解决

问题:勾选删除功能(待解决)

  • 目的:打算测试下,我勾选这里的删除选项后,是否本地的图片也会被删除?

  • 但是,这没找到删除按钮呢……(奇怪)

问题:PhotoPrism也不支持gif呀!(待解决)

  • 环境
2023年12月12日发现
  • 问题现象

PhotoPrism也不支持gif呀

  • 测试过程

把百度网盘里的gif图片都上传到ecs的/home/photoprism/photos/gif目录里

[root@docusaurus-wiki ~]# cd /home/photoprism/photos/
[root@docusaurus-wiki photos]# ls
gif 家人 摄影 自己 那份爱恋 高圆圆
[root@docusaurus-wiki photos]# ll gif/|head -5
total 46752
-rw-r--r-- 1 root root 204180 Dec 12 07:55 IMG_002.gif
-rw-r--r-- 1 root root 840947 Dec 12 07:55 IMG_003.gif
-rw-r--r-- 1 root root 142947 Dec 12 07:55 IMG_004.gif
-rw-r--r-- 1 root root 1102880 Dec 12 07:55 IMG_005.gif

[root@docusaurus-wiki photos]# ls gif/|wc -l
50
  • 然后,photoprism扫描成功后

  • 我们能够发现,PhotoPrism是不支持gif图片的哦。。。

  • 然后从ecs里把gif传到winodws里,观察下效果
[root@docusaurus-wiki photos]# sz gif/IMG_002.gif

可以看到,这个格式是没有被损坏的,那就是PhotoPrism不支持gif了。

  • 我们看下,还有其他什么需要单独设置的选项吗?

配置里没看到可以设置识别gif的选项。

  • 官网也没发现有用的知识点……

immich

官网

https://immich.app/

https://github.com/immich-app/immich

immich docker官网

https://github.com/imagegenius/docker-immich

部署

docker安装 portainer命令

docker 安装 portainer命令:

docker run -d \
--name=portainer-zh \
-p 9000:9000 \ # 端口号根据实际情况可以修改
-v /var/run/docker.sock:/var/run/docker.sock \
--restart=always \
6053537/portainer-ce
docker run -d \
--name=portainer-zh \
-p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
--restart=always \
6053537/portainer-ce

[root@docker ~]#docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
903ee5c586a2 6053537/portainer-ce "/portainer" 13 seconds ago Up 12 seconds 8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp portainer-zh
[root@docker ~]#

admin/admin@123

---
version: "2.1"
services:
immich:
image: ghcr.io/imagegenius/immich:latest
container_name: immich
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- DB_HOSTNAME=192.168.1.x
- DB_USERNAME=postgres
- DB_PASSWORD=postgres
- DB_DATABASE_NAME=immich
- REDIS_HOSTNAME=192.168.1.x
- DISABLE_MACHINE_LEARNING=false #optional
- DISABLE_TYPESENSE=false #optional
- DB_PORT=5432 #optional
- REDIS_PORT=6379 #optional
- REDIS_PASSWORD= #optional
- MACHINE_LEARNING_WORKERS=1 #optional
- MACHINE_LEARNING_WORKER_TIMEOUT=120 #optional
volumes:
- path_to_appdata:/config
- path_to_photos:/photos
- path_to_machine-learning:/config/machine-learning #optional
- path_to_imports:/import:ro #optional
ports:
- 8080:8080
restart: unless-stopped
# This container requires an external application to be run separately to be run separately.
# Redis:
redis:
image: redis
ports:
- 6379:6379
container_name: redis
# PostgreSQL 14:
postgres14:
image: postgres:14
ports:
- 5432:5432
container_name: postgres14
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: immich
volumes:
- path_to_postgres:/var/lib/postgresql/data

---
version: "2.1"
services:
immich:
image: ghcr.io/imagegenius/immich:latest
container_name: immich
environment:
- PUID=1000
- PGID=1000
- TZ=Asia/Shanghai
- DB_HOSTNAME=172.29.9.65
- DB_USERNAME=postgres
- DB_PASSWORD=postgres
- DB_DATABASE_NAME=immich
- REDIS_HOSTNAME=172.29.9.65
- DISABLE_MACHINE_LEARNING=false #optional
- DISABLE_TYPESENSE=false #optional
- DB_PORT=5432 #optional
- REDIS_PORT=6379 #optional
- REDIS_PASSWORD= #optional
- MACHINE_LEARNING_WORKERS=1 #optional
- MACHINE_LEARNING_WORKER_TIMEOUT=120 #optional
volumes:
- /root/immich/config:/config
- /root/immich/photos:/photos
- /root/immich/machine:/config/machine-learning #optional
- /root/immich/imports:/import:ro #optional
ports:
- 8080:8080
restart: unless-stopped
# This container requires an external application to be run separately to be run separately.
# Redis:
redis:
image: redis
ports:
- 6379:6379
container_name: redis
# PostgreSQL 14:
postgres14:
image: postgres:14
ports:
- 5432:5432
container_name: postgres14
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: immich
volumes:
- /root/immich/postgresData:/var/lib/postgresql/data

docker run -d \
--name=immich \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e DB_HOSTNAME=47.100.215.163 \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=postgres \
-e DB_DATABASE_NAME=immich \
-e REDIS_HOSTNAME=47.100.215.163 \
-e DISABLE_MACHINE_LEARNING=false `#optional` \
-e DISABLE_TYPESENSE=false `#optional` \
-e DB_PORT=5432 `#optional` \
-e REDIS_PORT=6379 `#optional` \
-e REDIS_PASSWORD= `#optional` \
-e MACHINE_LEARNING_WORKERS=1 `#optional` \
-e MACHINE_LEARNING_WORKER_TIMEOUT=120 `#optional` \
-p 8080:8080 \
-v /root/immich/config:/config \
-v /root/immich/photos:/photos \
-v /root/immich/machine:/config/machine-learning `#optional` \
-v /root/immich/imports:/import:ro `#optional` \
--restart unless-stopped \
ghcr.io/imagegenius/immich:latest

# This container requires an external application to be run separately.
# Redis:
docker run -d \
--name=redis \
-p 6379:6379 \
redis

# PostgreSQL 14:
docker run -d \
--name=postgres14 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=immich \
-v /root/immich/postgresData:/var/lib/postgresql/data \
-p 5432:5432 \
postgres:14


总共5个路径需要我们去改下:

[root@docker ~]#mkdir immich
[root@docker ~]#cd immich/
[root@docker immich]#mkdir config
[root@docker immich]#mkdir photos
[root@docker immich]#pwd
/root/immich
[root@docker immich]#mkdir machine
[root@docker immich]#mkdir imports
[root@docker immich]#mkdir postgresData


[root@docker immich]#netstat -antlp|grep 5432
[root@docker immich]#netstat -antlp|grep 6379
[root@docker immich]#netstat -antlp|grep 8080

第一次安装完portainer后,要配置下这里:

这个镜像下载好慢……(多等一会儿,后面就快了)

部署成功

参考

https://zhuanlan.zhihu.com/p/656877592

https://www.huluohu.com/posts/788/

https://baijiahao.baidu.com/s?id=1779834814928393391&wfr=spider&for=pc

https://blog.csdn.net/tianjindong0804/article/details/130668960

案例:自开发(图床)

https://gitee.com/itchenliang/quickly-picture-bed

ecs部署

删除容器

docker rm -f postgres14 redis immich

docker stop postgres14 redis immich

rm -rf immich

ecs1部署(部署成功代码)

mkdir immich
cd immich/
mkdir config
mkdir photos
mkdir machine
mkdir imports
mkdir postgresData

docker run -d \
--name=immich \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e DB_HOSTNAME=47.97.48.237 \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=postgres \
-e DB_DATABASE_NAME=immich \
-e REDIS_HOSTNAME=47.97.48.237 \
-e DISABLE_MACHINE_LEARNING=false `#optional` \
-e DISABLE_TYPESENSE=false `#optional` \
-e DB_PORT=5432 `#optional` \
-e REDIS_PORT=6379 `#optional` \
-e REDIS_PASSWORD= `#optional` \
-e MACHINE_LEARNING_WORKERS=1 `#optional` \
-e MACHINE_LEARNING_WORKER_TIMEOUT=120 `#optional` \
-p 8080:8080 \
-v /root/immich/config:/config \
-v /root/immich/photos:/photos \
-v /root/immich/machine:/config/machine-learning `#optional` \
-v /root/immich/imports:/import:ro `#optional` \
--restart unless-stopped \
ghcr.io/imagegenius/immich:latest

# This container requires an external application to be run separately.
# Redis:
docker run -d \
--name=redis \
-p 6379:6379 \
redis

# PostgreSQL 14:
docker run -d \
--name=postgres14 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=immich \
-v /root/immich/postgresData:/var/lib/postgresql/data \
-p 5432:5432 \
postgres:14


ecs2部署(部署成功代码)

http://47.100.215.163:8080

mkdir immich
cd immich/
mkdir config
mkdir photos
mkdir machine
mkdir imports
mkdir postgresData

docker run -d \
--name=immich \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e DB_HOSTNAME=47.100.215.163 \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=postgres \
-e DB_DATABASE_NAME=immich \
-e REDIS_HOSTNAME=47.100.215.163 \
-e DISABLE_MACHINE_LEARNING=false `#optional` \
-e DISABLE_TYPESENSE=false `#optional` \
-e DB_PORT=5432 `#optional` \
-e REDIS_PORT=6379 `#optional` \
-e REDIS_PASSWORD= `#optional` \
-e MACHINE_LEARNING_WORKERS=1 `#optional` \
-e MACHINE_LEARNING_WORKER_TIMEOUT=120 `#optional` \
-p 8080:8080 \
-v /root/immich/config:/config \
-v /root/immich/photos:/photos \
-v /root/immich/machine:/config/machine-learning `#optional` \
-v /root/immich/imports:/import:ro `#optional` \
--restart unless-stopped \
ghcr.io/imagegenius/immich:latest

# This container requires an external application to be run separately.
# Redis:
docker run -d \
--name=redis \
-p 6379:6379 \
redis

# PostgreSQL 14:
docker run -d \
--name=postgres14 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=immich \
-v /root/immich/postgresData:/var/lib/postgresql/data \
-p 5432:5432 \
postgres:14

报错了……

  • 奇怪,ecs上搭建的这个immich一段时间后就会报错,但是自己本地虚机搭建的没有出现过报错……

Piwigo和Lychee比较,推荐使用哪个?

案例

https://www.bilibili.com/read/cv15637928/

案例(已阅读)

https://post.smzdm.com/p/aoo8v7k9/?ivk_sa=1024320u

Piwigo

总结