nextcloud / docker

⛴ Docker image of Nextcloud
https://hub.docker.com/_/nextcloud/
GNU Affero General Public License v3.0
6.07k stars 1.83k forks source link

No video preview thumbnails #1432

Closed HawaiianPizza closed 3 years ago

HawaiianPizza commented 3 years ago

Nextcloud version: 20.0.7 Operating system and version: Ubuntu 20.04.2 LTS on Raspberry Pi 4


None of my videos uploaded onto my Nextcloud (installed via Docker-Compose) are showing any thumbnails. Images (GIF, JPEG, PNG) are fine and thumbnails are generated. However, it's not the same for videos.

I've attached an image of how my videos look like.

thumbnails

DatAres37 commented 3 years ago

What makes you think that Nextcloud generates video thumbnails? There are no video thumbnails on the official Nextcloud demo for me.

J0WI commented 3 years ago

Video preview thumbnails require FFmpeg: https://github.com/nextcloud/docker/tree/master/.examples#ffmpeg

fstani commented 3 years ago

What makes you think that Nextcloud generates video thumbnails? There are no video thumbnails on the official Nextcloud demo for me.

As @J0WI pointed out it does support generating video thumbnails if you have FFmpeg installed, my suggestion would be to have a full version of nextcloud with that pre-installed if possible. But that aside, we can just create our own Dockerfile and upload to dockerhub, you can either grab the full example and just build and upload or create one with just FFmpeg.

FROM nextcloud:apache

RUN set -ex; \
    apt-get update; \
    apt-get install -y ffmpeg; \

CMD ["apache2-foreground"]

My guess is something like that should work

fstani commented 3 years ago

If you want to test you can also just drop in the shell in your container, and install FFmpeg manually

You will also need to add this:

'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\TIFF',
    9 => 'OC\\Preview\\SVG',
   10 => 'OC\\Preview\\Font',
   11 => 'OC\\Preview\\MP3',
   12 => 'OC\\Preview\\Movie',
   13 => 'OC\\Preview\\MKV',
   14 => 'OC\\Preview\\MP4',
   15 => 'OC\\Preview\\AVI',
 )

To your config.php

boombatower commented 3 years ago

Any chance a ffmpeg/video or full variant can be provided as a tag similar to alpine? I imagine video previews is a rather common desired feature.

fstani commented 3 years ago

I would also rather just use a package from the maintaner rather than having to build my own, but @boombatower I'm going to build one and put it on dockerhub, since I'm using it as well 😄

boombatower commented 3 years ago

I built such an image (just install ffmpeg on base production image). Could do it fancy and mimic all the tags with ffmpeg, but... I think the new repository linking does not work properly for official images like it used to so I'll probably have to setup a trigger to rebuild it.

Would much prefer and official image.

rosalinamia3 commented 3 years ago

Hi to all, i am new in here. I am sorry but I have the same problem too. No video previews. I have asked my server provider to install ffmpeg as I have no root privileges. Nothing has changed. All the videos uploaded before and after the ffmpeg installation have no previews. I have also added a cron job /public_html/occ preview:pre-generate -vvv but nothing happened. I have installed the app Preview Generator and follow their instructions: "The first time you install this app, before using a cron job, you properly want to generate all previews via: ./occ preview:generate-all -vvv

Important: To enable pre-generation of previews you must add php /var/www/nextcloud/occ preview:pre-generate to a system cron job that runs at times of your choosing." But nothing happened. Do you have any suggestions? Is there a chance to have a support for this issue? Is this a problem that it will show up on every nextcloud installation? Thanks in advance for your support. Regards Schermata 2021-04-12 alle 10 00 06

J0WI commented 3 years ago

I have asked my server provider to install ffmpeg as I have no root privileges.

This issue is only for the Docker image.

You should to compare your enabledPreviewProviders with https://github.com/nextcloud/docker/issues/1432#issuecomment-806654679.

rosalinamia3 commented 3 years ago

Hi @J0WI, thanks for your reply. I have already in my config.php file following: 'enable_previews' => true, 'enabledPreviewProviders' => array ( 0 => 'OC\Preview\TXT', 1 => 'OC\Preview\MarkDown', 2 => 'OC\Preview\OpenDocument', 3 => 'OC\Preview\PDF', 4 => 'OC\Preview\MSOffice2003', 5 => 'OC\Preview\MSOfficeDoc', 6 => 'OC\Preview\Image', 7 => 'OC\Preview\Photoshop', 8 => 'OC\Preview\TIFF', 9 => 'OC\Preview\SVG', 10 => 'OC\Preview\Font', 11 => 'OC\Preview\MP3', 12 => 'OC\Preview\Movie', 13 => 'OC\Preview\MKV', 14 => 'OC\Preview\MP4', 15 => 'OC\Preview\AVI', ) What I have found out since now is. I am on a shared hosting server and also nextcloud app Preview Generator works fine but creates only image previews not video previews. I believe the only ffmpeg creates video previews but I do not know where ffmpeg creates thumbnails (path) and what is the ssh comand to let ffmpeg generates all previews. hope you can help

rosalinamia3 commented 3 years ago

I have run this comand: /home/st9284/ffmpeg/ffmpeg -version ffmpeg version N-53260-ga37109d555-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 56. 55.100 / 56. 55.100 libavcodec 58. 92.100 / 58. 92.100 libavformat 58. 46.101 / 58. 46.101 libavdevice 58. 11.100 / 58. 11.100 libavfilter 7. 86.100 / 7. 86.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100

what is Docker?

J0WI commented 3 years ago

Nextcloud expects th ffmpeg in one these directories: https://github.com/nextcloud/server/blob/v21.0.1/lib/private/legacy/OC_Helper.php#L469

Please use https://help.nextcloud.com/ for arbitrary questions.

I'm closing the issue, because the initial cause was already solved in https://github.com/nextcloud/docker/issues/1432#issuecomment-798952368

boombatower commented 3 years ago

@J0WI Do we need to open another issue then for providing a container image flavor with ffmpeg installed?

J0WI commented 3 years ago

The package can easily be added on top of the current image. We don't include every optional dependency for every app. See also: https://github.com/nextcloud/docker/issues/63#issuecomment-299688083 https://github.com/nextcloud/photos/issues/362

boombatower commented 3 years ago

Different definitions of easy I suppose. One of the primary points of using an official docker image is that I do not have to maintain the software stack within. Having to install something into an official container and do so every time it updates is not zero work. If I had to do this for all the software I host I would go cross-eyed.

We don't include every optional dependency for every app.

No one asked for this, just one dependency for one app. If this is not valued or commonly used, as was put forth in this issue, that is a valid reason not to, but this statement is irrelevant.

I'll take your response as indication that upstream is not interested in considering this and that I will need to look into a maintained method for rebuilding an image with a one-line addition whenever the official image updates. :( :( :(

boombatower commented 3 years ago

I would put forth there is more value in an ffmpeg variant than apache, fpm, and fpm-alpine, but to each their own.

J0WI commented 3 years ago

Adding the package is easier than removing it. It's as easy as having a docker exec apk add --no-cache ffmpeg hook somewhere. There was a similar discussion about imagemagick in https://github.com/nextcloud/docker/issues/1414.

boombatower commented 3 years ago

hook somewhere

The somewhere is the key part. The command you referenced is what I did it ensure that was all that was needed and have been running it that way until I decide how to proceed.

The problem is that when using automated or managed update systems they are generally designed with the assumption that you have an image containing what you want and when the source image changes you update the local one.

Thanks for the other issue pointer.

meckitt commented 3 years ago

Did it really easy with docker-compose:

  1. added to the docker-compose.yaml container_name: nextcloud
  2. added ffmpeg.sh and did chmod +x ffmpeg.sh
  3. in the ffmpeg.sh i added two commands:
    • docker exec nextcloud apt-get update
    • docker exec nextcloud apt-get install ffmpeg --yes

Now you only have to exec the ffmpeg.sh script after updating the file.

Hope this helps.

FunctionDJ commented 1 year ago

My solution with docker-compose: command: bash -c "apt update && apt install ffmpeg -y && apache2-foreground"

adimol commented 1 year ago

@FunctionDJ --- I believe there's an issue in using the above command flag, and it will cause side effects. Nextcloud upgrades are not working properly when using the above mentioned "command" in docker-compose. I looked a bit into this, and I think I found the reason, as described below.

The "command" flag will overwrite nextcloud's image "CMD" flag. That's fine, since instead of doing just "apache2-foreground", with the command flag, we'll end up installing ffmpeg first, and then calling apache2-foreground.

The problem is how this command / CMD will interact with the ENTRYPOINT, and particularly the entrypoint.sh script that nextloud container is calling. In docker, CMD commands will be passed at the end of the ENTRYPOINT commands. Looking at nextcloud's Dockerfile, we have:

ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"]

When the above container is ran, the final command will be:

/entrypoint.sh apache2-foreground".

But when we use the "command" flag to install ffmpeg, the final command will be:

/entrypoint.sh bash -c "apt update && apt install ffmpeg -y && apache2-foreground"

The entrypoint.sh script is important to run well, because this is where upgrades are handled / started. Looking inside the that script, there are checks for the 1st argument to that script, where it looks if it's "apache" or "php-fpm". Because we modified these positional argument by using the docker-compose "command", the upgrade doesn't seem to start. Similar thing happens on first time install --- the above command will make the installation unsuccessful.

adimol commented 1 year ago

I really think this video preview feature should be properly supported by the official image. I don't agree with the maintainers' position of avoiding to support it, resulting in a basic nextcloud feature not functioning properly.

adimol commented 1 year ago

For the time being, my proposed solution is to use the following in docker-compose.yml:

entrypoint: bash -c "apt update && apt install ffmpeg -y && /entrypoint.sh apache2-foreground"

I haven't tested it during an upgrade, but I would expect it to work.

I'm not 100% happy with this kind of "band-aid hacks", as they rely on specific knowledge of the internals (i.e entrypoint.sh). These internal scripts could easily change in the future and might invalidate this or other similar solutions.

networkException commented 1 year ago

You might need to set NEXTCLOUD_UPDATE=1 as described in https://github.com/nextcloud/docker#adding-features for updates to work

cmidkiff87 commented 1 year ago

For anyone else having this issue, you need both ffmpeg and imagemagick-common installed on both the main app container and the image generation container (cron in my case)

this is my docker file both app and cron

FROM nextcloud:apache

RUN apt-get update && apt-get install -y \
    imagemagick-common \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*
docker-compose.yaml ```yaml version: '3' services: db: image: postgres:alpine restart: always volumes: - db:/var/lib/postgresql/data:Z env_file: - db.env redis: image: redis:alpine restart: always app: build: ./app restart: always volumes: - ncserver_html:/var/www/html:z - ncserver_data:/usr/nextcloud/data:z - ncserver_config:/var/www/html/config:z - /var/log/nextcloud:/var/log/nextcloud environment: - VIRTUAL_HOST=_____________ - LETSENCRYPT_HOST=_____________ - LETSENCRYPT_EMAIL=______________ - POSTGRES_HOST=db - REDIS_HOST=redis - PHP_MEMORY_LIMIT=2G env_file: - db.env depends_on: - db - redis - imaginary networks: - proxy-tier - default cron: # image: nextcloud:apache build: ./cron restart: always volumes_from: - app:rw environment: - PHP_MEMORY_LIMIT=2G entrypoint: /cron.sh depends_on: - db - redis proxy: build: ./proxy restart: always ports: - 80:80 - 443:443 labels: com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" volumes: - certs:/etc/nginx/certs:z,ro - vhost.d:/etc/nginx/vhost.d:z - nginx_html:/usr/share/nginx/html:z - /var/run/docker.sock:/tmp/docker.sock:z,ro environment: - 'ENABLE_IPV6=true' networks: - proxy-tier letsencrypt-companion: image: nginxproxy/acme-companion:latest restart: always volumes: - certs:/etc/nginx/certs:z - acme:/etc/acme.sh:z - vhost.d:/etc/nginx/vhost.d:z - nginx_html:/usr/share/nginx/html:z - /var/run/docker.sock:/var/run/docker.sock:z,ro environment: - DEFAULT_EMAIL=______________ networks: - proxy-tier depends_on: - proxy # i use this to shell into /var/www/html and run occ commands, and edit config files # it also has sudo and vim installed occ: build: ./occ volumes_from: - app:rw environment: - PHP_MEMORY_LIMIT=2G depends_on: - imaginary networks: - default # fast thumbnail service imaginary: image: nextcloud/aio-imaginary:latest # optionally mount a volume as local image source volumes: - imaginary_images:/mnt/data environment: PORT: 9000 command: -enable-url-source -mount /mnt/data ports: - 9000:9000 networks: - default volumes: db: certs: acme: vhost.d: nginx_html: ncserver_html: ncserver_data: ncserver_config: imaginary_images: networks: proxy-tier: ```

I'm also using Preview Generator

Trufax commented 1 year ago

@adimol adimol

I haven't tested it during an upgrade, but I would expect it to work.

Did you have any issues with updates so far ? I prefer this solution so i don't have to build my own image all the time.

adimol commented 1 year ago

@Trufax - I've been using that solution and I haven't had any issues so far. All the updates worked well.

faxotherapy commented 1 year ago

Unfortunately, I still have no video preview thumbnail under 27.1.3 (installed via snap) even though the following installed/added:

I really don't know what else I could do to make this thing work.

I have thumbnail preview for pics and MarkDown, but no for videos.

Last resort before I give up. Is it anything to do with the fact I don't have a login shell set for www-data user? Edit: I enabled shell login for this user, re-ran the generator under it, and still not working.

joshtrichards commented 1 year ago

@faxotherapy The Snap is an entirely different animal. This thread is about the micro-services Docker image. The approaches described here will not help you.

You need to look around here:

https://github.com/nextcloud-snap/nextcloud-snap/

E.g. https://github.com/nextcloud-snap/nextcloud-snap/issues/1327

shenava77 commented 12 months ago

Hi every one I have the same problem (No video preview) I use TrueNAS-13.0-U5.3 as server, and install nextcloud version 27.1.3 but No video preview can some one help me how to fix it?

faxotherapy commented 12 months ago

Maybe this post can help…

HetorusNL commented 11 months ago

As it's still not in the official nextcloud images, I'm using the 'hetorusnl/nextcloud-ffmpeg' image, that's automagically built by Github Actions on a weekly basis based on the nextcloud:apache image. Github repo link: https://github.com/HetorusNL/custom-docker-images/ Dockerhub link: https://hub.docker.com/r/hetorusnl/nextcloud-ffmpeg

And the following configuration in config/config.php for the video previews:

  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\BMP',
    1 => 'OC\\Preview\\GIF',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\MarkDown',
    4 => 'OC\\Preview\\MP3',
    5 => 'OC\\Preview\\PNG',
    6 => 'OC\\Preview\\TXT',
    7 => 'OC\\Preview\\XBitmap',
    8 => 'OC\\Preview\\OpenDocument',
    9 => 'OC\\Preview\\Krita',
    10 => 'OC\\Preview\\HEIC',
    11 => 'OC\\Preview\\SVG',
    12 => 'OC\\Preview\\Movie',
    13 => 'OC\\Preview\\MKV',
    14 => 'OC\\Preview\\MP4',
    15 => 'OC\\Preview\\AVI',
  ),
ados8 commented 7 months ago

I'm baffled that core components needed for NC to function at full are left out of docker. I installed the following manually just to get the health warnings page to settle down and restore features.

ffmpeg pdlib bzip

Please include in the official image or have tags so people can install images that allow full features.

Hi-ImKyle commented 4 months ago

I'm getting thumbnails for most file types, just gifs seem to be left out. Does anyone happen to know what is needed for gifs to get previews?