Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Thumbnails Failing to Generate on NextCloud Snap #1327

Open
vanimox opened this issue May 4, 2020 · 57 comments
Open

Video Thumbnails Failing to Generate on NextCloud Snap #1327

vanimox opened this issue May 4, 2020 · 57 comments
Labels
feature New feature or request help wanted

Comments

@vanimox
Copy link

vanimox commented May 4, 2020

I am running Ubuntu Server version 20.04 LTS and successfully installed NextCloud Snap; however, video thumbnails are not working.

I installed FFmpeg and edited the config.php with the following text:

'enable_previews' => true,
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\TXT',
1 => 'OC\\Preview\\Image',
2 => 'OC\\Preview\\Movie',
3 => 'OC\\Preview\\MP4',
),

But the same issue of not video thumbnails is occurring. Any assistance you might be able to provide would be incredibly helpful.

Thank you so much!

@kyrofa
Copy link
Member

kyrofa commented Jun 5, 2020

Note that the snap is confined, and will be unable to access the ffmpeg you have installed on your host. If that's required in order to generate these thumbnails (not something I know for sure), I'm afraid this won't be possible.

@thenickname
Copy link

This is a general issue, right? Not an individual and specific configuration question of one user. Video thumbnails are not generated in the snap. At this point one assumption as to why that happens is a missing dependency in the snap, e.g. ffmpeg (?)

Should ffmpeg then be bundeled in the snap (if the assumption as to why it fails is true)?

@thenickname
Copy link

Here's a conversation in an old nextcloud issue mentioning the dependency to ffmpeg and/or avconf nextcloud/server#2011 (comment)

So indeed, in order to generate video thumbs, those additional dependencies must be installed and currently there is no way to do it in the snap version (apart from shipping ffmpeg with the snap). Or is it possible somehow?

@thenickname
Copy link

Duplicate: #1314

@OrelEagle
Copy link

Is there a reason for not including ffmpeg in the snap?

@gchmurka123
Copy link

I am very unlucky because of the lack of ffmpeg content in snap nextcloud.
These libraries should be added to have a fully functional nexcloud.

Due to the lack of this library, I am forced to install nexcloud manually. The developers promised that it would be fast and good with snap, and it is as usual... ;(

@per2jensen
Copy link

Note that the snap is confined, and will be unable to access the ffmpeg you have installed on your host. If that's required in order to generate these thumbnails (not something I know for sure), I'm afraid this won't be possible.

@kyrofa - would you accept a PR that appended ffmpeg to the snap ?

@kyrofa
Copy link
Member

kyrofa commented Jun 28, 2020

@per2jensen I'd be willing to entertain the idea. Depends on how much bloat and new code it introduces, and I'll need to give ffmpeg a review from a security standpoint.

@per2jensen
Copy link

Both security and bloat are important points, take a look and decide.
Meanwhile I'll take a shot at it, don't hold your breath, as I need to learn how to do snaps and also learn the ins and outs of NC.

@per2jensen
Copy link

It looks like ffmpeg can be pulled from core18. Saw an ffmpeg with a 2018 timestamp in one of my build tries earlier this evening.
I expect you would prefer that over a freshly build ffmpeg due to receiving patches from Canonical via core18 ?
I have nextcloud 19 built with ffmpeg v. 4.3, but will no go further with that, if you prefer the core18 version.

@kyrofa
Copy link
Member

kyrofa commented Jun 29, 2020

You're spot on. If you can make stage-packages work I would agree that is preferable.

@per2jensen
Copy link

I have a snap running with ffmpeg, but struggle to persuade "previewgenerator" doing movie previews.

previewgenerator expects to be run from cron every so often. Does the snapped NC include a cron, if yes I have not yet found out how to set it up.

@laurens94
Copy link

@per2jensen Just in case: did you append the following config to /var/snap/nextcloud/current/nextcloud/config/config.php?

'enable_previews' => true,
'enabledPreviewProviders' =>
 array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\Movie',
    3 => 'OC\\Preview\\MKV',
    4 => 'OC\\Preview\\MP4',
    5 => 'OC\\Preview\\AVI',
 ),

After adding that, I believe they should be generated when you run sudo nextcloud.occ preview:generate-all.

Thanks for looking into it 👍

@montvid
Copy link

montvid commented Dec 27, 2020

Can one use a static build of ffmpeg if sudo snap connect nextcloud:removable-media is enabled? How to set this up? Where to write the path to ffmpeg in the nextcloud snap?

I think it is a pain in the eyes that there are no thumbnails of videos as the photos app shows them but one can't discern by a generic thumbnail. I propose to disable the showing of video thumbnails in the photos app if ffmpeg is not included but how to do it @kyrofa?

@thomascobb
Copy link
Contributor

@per2jensen the snap has something that runs the nextcloud cron.php at various intervals: https://github.com/nextcloud/nextcloud-snap/blob/master/src/nextcloud/bin/nextcloud-cron

@thve25
Copy link

thve25 commented Feb 4, 2021

Is there a solution for this problem yet? I still cannot generate thumbnails in nextcloud snap.

Thanks

@komsadiman
Copy link

Good afternoon, also tormented by this problem, tell me did not solve it?

@Ben-collectAI
Copy link

I'm not a developer but I found this in the snap documentation: https://snapcraft.io/docs/thumbnailer-service-interface

Idea: Could it be used (after connecting it) by the preview app (for instance as option to set via occ command) so that snaps can create previews as well?

It would be great for nextcloud snap users! 🙂

@SpecifiedNull
Copy link

image
I'm having the same problem. installed nextcloud via snap and now video thumbnails won't show even though I installed ffmpeg via sudo apt-get install ffmpeg and also sudo snap install ffmpeg.
And then ran these commands:
sudo nextcloud.occ preview:pre-generate
sudo nextcloud.occ preview:generate-all
sudo nextcloud.occ preview:generate-all -vvv
But no luck. video thumbnails do not generate at all

@NaXal
Copy link

NaXal commented Dec 1, 2021

I am also an user in queue to get video previews / thumbnails.

My installation details => Ubuntu 20 LTS / Snap NextCloud 22.2.3

Is there any update to this thread? For getting video thumbnails?

Thanks.

@aidancrane
Copy link

aidancrane commented Dec 1, 2021

I also have this with Ubuntu 20, latest snap nextcloud.
image

@dillfrescott
Copy link

Another user without video thumbnails here! Why isn't this fixed?

@kyrofa
Copy link
Member

kyrofa commented Dec 3, 2021

As I've said before, I'm willing to review a PR that adds ffmpeg/libav if someone wants to take a crack at this.

Why isn't this fixed?

Because we're volunteers and have a finite amount of time that needs to be prioritized.

@dillfrescott
Copy link

Got it. Sorry! I didn't mean for it to sound like that.

@aidancrane
Copy link

I decided to rebuild to a lamp stack.

@pachulo
Copy link
Member

pachulo commented Dec 19, 2021

As I've said before, I'm willing to review a PR that adds ffmpeg/libav if someone wants to take a crack at this.

@kyrofa do you think it would be possible to use this https://forum.snapcraft.io/t/using-chromium-ffmpeg-in-third-party-browser-snaps/6545 instead?

@kyrofa
Copy link
Member

kyrofa commented Dec 27, 2021

@pachulo I don't trust that type of thing to stick around or stay stable, to be honest.

@hjylewis
Copy link

Is there not a hacky way to achieve this on our personal servers?

@merrpink
Copy link

[...] if it doesn't work right, there is really no point in this project at all.

That's a rather uncharitable attitude toward the vast amount of time I and others have dedicated to this project over the years. We all have a different definition of "working right", which is just part of using software. If this is a feature you require and you want to use the snap, feel free to add it. If you also don't have time, then you'll need to install Nextcloud in another way.

Yes, it was a bit uncharitable and I apologize. I was frustrated that, after having fumbled for days trying to fix it, I finally discover it is un-fixable. Then I had to move all my stuff somewhere else, delete the snap and re-install the regular version so nextcloud could work as it should. For me, thumbs for vids is a basic necessity.

You are also correct in saying that if I want a functionality, I should add it. As I (also) don't have the time, I will take your advice and use another version. However, and to be fair to your users, I think you should warn your users that this basic functionality will not be available in the snap version. If I had known, I would not have used the snap in the first place, and saved myself a ton of headache with all the work required to migrate to another setup.

Finally, I would like to say that I greatly value all the work you have done for this project which really, really simplifies the installation and updating process of Nextcloud, and makes a self-hosted Nextcloud a possibility for a much larger group than the original version appeals to. I would go so far as to say that I would happily pay for your version (with working vid thumbs of course) if I found it somewhere else. This is the problem with open source. People forget or procrastinate with donations, but if they are charged up front, many will be happy to pay, but I'm drifting into another subject now...

pachulo added a commit to pachulo/nextcloud-snap that referenced this issue Feb 25, 2022
This should enable the creation of Movie files thumbnails

Fixes nextcloud-snap#1327
pachulo added a commit to pachulo/nextcloud-snap that referenced this issue Feb 26, 2022
By adding ffmpeg and libslang2 to php stage-packages.

Also trim some unnecesary folders from the installed packages.

Fixes nextcloud-snap#1327
@pachulo pachulo added the feature New feature or request label Mar 12, 2022
@truelai
Copy link

truelai commented Jun 1, 2022

Looks like we're close to a fix for the snap version? See this PR from @pachulo

Seems all we need is feedback from @kyrofa on whether the switch from the Universe PPA to this PPA and validation that the static build approach is a non-starter. Who knows when that will happen? With 5 kids, robots, and us ingrates making demands, might be a while.

@ShadabFaiz
Copy link

I just have 2 questions:

  1. can any one tell where we are with fixes ?
  2. does NextCloud AIO also have this issue ?

@NaXal
Copy link

NaXal commented Mar 22, 2023

Hello,

2. does NextCloud AIO also have this issue ?

The official Docker based Nextcloud AIO doesn't have this issue.

Thanks.

@Routable
Copy link

Routable commented May 2, 2023

Summarizing this for any other unfortunate souls that installed Nextcloud via snap:

There is no fix for your issue. Stop the hunt, and give up..

Uninstall the snap (sudo snap remove nextcloud), and reinstall via docker (https://github.com/nextcloud/docker) and avoid using this snap (and all other snaps for that matter) in the future.

@FedeBx
Copy link

FedeBx commented Jul 10, 2023

@Routable

Dear, I can understand your frustration. But let me clarify to the readers, that after hours of work by many people who voluntarily put their hands to work (@kyrofa , @pachulo , @szaimen , @Jachhj-sc , @shaman79 , and others.) , it is possible to see the previews of the images and videos using SNAP.

I was frustrated for a long time because it couldn't be done, but now if it's possible, I'll share what I have running in case it helps:

environment data:

SO - Distributor ID: Ubuntu - Description: Ubuntu 20.04.6 LTS - Codename: focal

SNAP
nextcloud 26.0.2snap1 35830 latest/stable nextcloud✓ -

Preview Generator 5.3.0
Run ./occ preview:generate-all once after installation.
Add a (system) cron job for ./occ preview:pre-generate

install ffmpeg
#1046 (comment)

I suggest you use memories, it has some improvements over Photos and include ffmpeg and exiftool

I hope it's helpful if you want to return to SNAP.

@ZOKOB
Copy link

ZOKOB commented Aug 2, 2023

hello, I followed the tutorial except that it does not work, can you detail a little more the steps to follow please.

thanking you in advance
I wish you a good day
Sincerely Remy

@FedeBx
Copy link

FedeBx commented Aug 3, 2023

hello, I followed the tutorial except that it does not work, can you detail a little more the steps to follow please.

thanking you in advance I wish you a good day Sincerely Remy

Dear, trying to help

In my Jul-10, 2023 post, I tried to comment on the versions I use and how I got the video previews to work.

If I think of a step by step, I hope I don't forget anything:
Assuming you have a similar or same scenario installed as the one I described: SO-Ubuntu & SNAP-Nextcloud

  1. Install Preview Generator and Memories from Nextcloud backend with admin user.

  2. Remember to add to the CRON what is necessary for Preview Generator
    Run ./occ preview:generate-all once after installation.
    Add a (system) cron job for ./occ preview:pre-generate (i.e. of line in my cron: */30 * * * * nextcloud.occ preview:pre-generate)

Here more info. https://github.com/nextcloud/previewgenerator

  1. install ffmpeg
    How to install ffmpeg? #1046 (comment)

  2. Remember to correctly configure your /var/snap/nextcloud/current/nextcloud/config/config.php file

Here an illustrative example, related to what we talked about here, the file contains much more data:

....
   'enable_previews' => true,
   'preview_ffmpeg_path' => '/var/snap/nextcloud/bin/ffmpeg',
   'enabledPreviewProviders' =>
   array(
     0 => 'OC\\Preview\\TXT',
     1 => 'OC\\Preview\\MarkDown',
     2 => 'OC\\Preview\\OpenDocument',
     3 => 'OC\\Preview\\PDF',
      .......=>....
      .......=>....
     16 => 'OC\\Preview\\Movie',
     17 => 'OC\\Preview\\MKV',
     18 => 'OC\\Preview\\MP4',
     19 => 'OC\\Preview\\AVI',
     20 => 'OC\\Preview\\HEIC',
     21 => 'OC\\Preview\\MOV',
   ),
....
....
   'memories.vod.ffprobe' => '/var/snap/nextcloud/bin/ffprobe',
   'memories.vod.ffmpeg' => '/var/snap/nextcloud/bin/ffmpeg',

Various Memories settings can be done from the Nextcloud backend (admin user) by selecting settings->memories

After the above, I suggest you do:
Delete all existing indexing tables:
occ memories:index --clear (is not work try nextcloud.occ memories:index --clear )

Force re-index all files:
occ memories:index --force (is not work try nextcloud.occ memories:index --force)

Right now, after the long day at work, I can't think of any other suggestions.

I hope they help you & someone else

@ZOKOB
Copy link

ZOKOB commented Aug 3, 2023

Good morning,

Thank you for your answer but it still doesn't work:

if I put this path there: /var/snap/nextcloud/bin/ffmpeg

I don't remember it finding the ffmpeg executable.

so I placed it here: /var/snap/nextcloud/common/nextcloud/data/bin/ffmpeg-git-20230721-amd64-static/ffmpeg there it recognizes it fine however still no video thumbnail even after typing the commands above.

Will everything be integrated in a future version?

@FedeBx
Copy link

FedeBx commented Aug 3, 2023

Good morning,

Thank you for your answer but it still doesn't work:

if I put this path there: /var/snap/nextcloud/bin/ffmpeg

I don't remember it finding the ffmpeg executable.

so I placed it here: /var/snap/nextcloud/common/nextcloud/data/bin/ffmpeg-git-20230721-amd64-static/ffmpeg there it recognizes it fine however still no video thumbnail even after typing the commands above.

Will everything be integrated in a future version?

If you downloaded the correct version for you: ffmpeg amd or i686. Assuming you did all about PreviewGeneretor and Memories index
I also suggest that the version of SNAP be at least the same as the one I reported above in this chat.

I leave you a screenshot of the permissions and owner of the files
image

In the route that I share it works for me, in another place it did not work for me and I have not investigated the reason. If it still doesn't work, please provide information on your OS, SNAP version and nextcloud config.php file

Will everything be integrated in a future version?
Those who know the most about this topic are evaluating security risks and time to understand feasibility. I'm just learning about all this, I don't have an answer to give you.

@ZOKOB
Copy link

ZOKOB commented Aug 4, 2023

hello I managed to configure the same path as you /var/snap/nextcloud/bin

my ffmpeg and ffprobe are well seen in memories I have restarted an indexing but still the same no videos thumbnail.

are you available to help me in remote maintenance please?

wishing you a pleasant day
cordially remy

@ZOKOB
Copy link

ZOKOB commented Aug 4, 2023

it's good everything finally works!
just can you tell me what you had put in your contrab please?

I put this line:

*/30 * * * * nextcloud.occ preview:pre-generate

is that enough?

@FedeBx
Copy link

FedeBx commented Aug 4, 2023

Great to hear that everything works!

with patience and dedication the benefits come! I hope you enjoy your video/image thumbnails

I shared my line in the contrab (#1327 (comment)), it is the same as what you write. needed to generate preview for new files if applicable.

Today we laugh :-) and celebrate because you made it

@ZOKOB
Copy link

ZOKOB commented Aug 4, 2023

Thank you for your answer,
I have added the Line you told me in your last comment.
Good night and thank you so much for the support

@kzoid
Copy link

kzoid commented Aug 9, 2023

Folks,

Just want to share that I had been struggling with this issue for weeks now and what worked was putting the binaries inside /var/snap/nextcloud/bin/.

You can have ffmpeg in /usr/bin/ffmpeg, run the command in verbose mode and see all the "Generating views for..." messages but none of that really matters because it doesn't work.

If someone is still having troubles:

  • Download binaries from https://johnvansickle.com/ffmpeg/
  • Put them inside /var/snap/nextcloud/bin/
  • Update config /var/snap/nextcloud/current/nextcloud/config/config.php
'preview_ffmpeg_path' => '/var/snap/nextcloud/bin/ffmpeg',
'memories.vod.ffprobe' => '/var/snap/nextcloud/bin/ffprobe',
'memories.vod.ffmpeg' => '/var/snap/nextcloud/bin/ffmpeg',
  • And run generate command again: sudo nextcloud.occ preview:generate-all -vvv

Maybe the Memories app isn't even necessary, but it's such a better app than Photos (because it works) that I'd rather keep it.

The problem with photos is that no matter what kind of sorting method I use (by date modified/created/uploaded), my gallery is always messed up. The memoirs state that "Sort photos and videos by capture date, parsed from Exif data". and it works perfectly. But this is another topic...

@FedeBx
Copy link

FedeBx commented Aug 9, 2023

Folks,

Just want to share that I had been struggling with this issue for weeks now and what worked was putting the binaries inside /var/snap/nextcloud/bin/.

You can have ffmpeg in /usr/bin/ffmpeg, run the command in verbose mode and see all the "Generating views for..." messages but none of that really matters because it doesn't work.

If someone is still having troubles:

  • Download binaries from https://johnvansickle.com/ffmpeg/
  • Put them inside /var/snap/nextcloud/bin/
  • Update config /var/snap/nextcloud/current/nextcloud/config/config.php
'preview_ffmpeg_path' => '/var/snap/nextcloud/bin/ffmpeg',
'memories.vod.ffprobe' => '/var/snap/nextcloud/bin/ffprobe',
'memories.vod.ffmpeg' => '/var/snap/nextcloud/bin/ffmpeg',
  • And run generate command again: sudo nextcloud.occ preview:generate-all -vvv

Maybe the Memories app isn't even necessary, but it's such a better app than Photos (because it works) that I'd rather keep it.

The problem with photos is that no matter what kind of sorting method I use (by date modified/created/uploaded), my gallery is always messed up. The memoirs state that "Sort photos and videos by capture date, parsed from Exif data". and it works perfectly. But this is another topic...

HI, so if I understood correctly, you managed to make it work, we can count it as another case that you can see the previews of photos and videos?

@kzoid
Copy link

kzoid commented Aug 9, 2023

HI, so if I understood correctly, you managed to make it work, we can count it as another case that you can see the previews of photos and videos?

Yes, working on both: web and mobile

@Jachhj-sc
Copy link

Confirmed got my config working too now. Previews on video's and photos

@rubenz91
Copy link

rubenz91 commented Aug 13, 2023

After @FedeBx steps mine still failed on Videos (MP4), tried and check that even on memories is showing fine, but nothing seems to make it work.
image
image

@FedeBx
Copy link

FedeBx commented Aug 14, 2023

@rubenz91

Hi, any suggestions:

  • Pay special attention to the details, for example: the path for ffmpeg , the permissions and user, you commented that he did it the same as me and I don't see it the same. Please, Put the ffmpeg and others files download from [ https://johnvansickle.com/ffmpeg/] inside the directory /var/snap/nextcloud/bin/ (view image Video Thumbnails Failing to Generate on NextCloud Snap #1327 (comment)) you have on more directory in path ->please modify path to /var/snap/nextcloud/bin/ffmpeg (idem other files)
  • and I suggest auditing the nextcloud config.php configuration.
  • Remember to re-index memories post changes

if it fails again you will have to share information from your OS and Snap versions , configuration file, -be careful to delete keys or security data before sharing-

@rubenz91
Copy link

@rubenz91

Hi, any suggestions:

  • Pay special attention to the details, for example: the path for ffmpeg , the permissions and user, you commented that he did it the same as me and I don't see it the same. Please, Put the ffmpeg and others files download from [ https://johnvansickle.com/ffmpeg/] inside the directory /var/snap/nextcloud/bin/ (view image Video Thumbnails Failing to Generate on NextCloud Snap #1327 (comment)) you have on more directory in path ->please modify path to /var/snap/nextcloud/bin/ffmpeg (idem other files)
  • and I suggest auditing the nextcloud config.php configuration.
  • Remember to re-index memories post changes

if it fails again you will have to share information from your OS and Snap versions , configuration file, -be careful to delete keys or security data before sharing-

Worked, as you say, that little change there made the whole difference. Thanks and apologies that I didn't pay attention to it.

@FedeBx
Copy link

FedeBx commented Aug 15, 2023

you are welcome. you made it , congratulations!!!

@Phils80
Copy link

Phils80 commented Oct 22, 2023

hello, I followed the tutorial except that it does not work, can you detail a little more the steps to follow please.
thanking you in advance I wish you a good day Sincerely Remy

Dear, trying to help

In my Jul-10, 2023 post, I tried to comment on the versions I use and how I got the video previews to work.

If I think of a step by step, I hope I don't forget anything: Assuming you have a similar or same scenario installed as the one I described: SO-Ubuntu & SNAP-Nextcloud

  1. Install Preview Generator and Memories from Nextcloud backend with admin user.
  2. Remember to add to the CRON what is necessary for Preview Generator
    Run ./occ preview:generate-all once after installation.
    Add a (system) cron job for ./occ preview:pre-generate (i.e. of line in my cron: */30 * * * * nextcloud.occ preview:pre-generate)

Here more info. https://github.com/nextcloud/previewgenerator

  1. install ffmpeg
    How to install ffmpeg? #1046 (comment)
  2. Remember to correctly configure your /var/snap/nextcloud/current/nextcloud/config/config.php file

Here an illustrative example, related to what we talked about here, the file contains much more data:

....
   'enable_previews' => true,
   'preview_ffmpeg_path' => '/var/snap/nextcloud/bin/ffmpeg',
   'enabledPreviewProviders' =>
   array(
     0 => 'OC\\Preview\\TXT',
     1 => 'OC\\Preview\\MarkDown',
     2 => 'OC\\Preview\\OpenDocument',
     3 => 'OC\\Preview\\PDF',
      .......=>....
      .......=>....
     16 => 'OC\\Preview\\Movie',
     17 => 'OC\\Preview\\MKV',
     18 => 'OC\\Preview\\MP4',
     19 => 'OC\\Preview\\AVI',
     20 => 'OC\\Preview\\HEIC',
     21 => 'OC\\Preview\\MOV',
   ),
....
....
   'memories.vod.ffprobe' => '/var/snap/nextcloud/bin/ffprobe',
   'memories.vod.ffmpeg' => '/var/snap/nextcloud/bin/ffmpeg',

Various Memories settings can be done from the Nextcloud backend (admin user) by selecting settings->memories

After the above, I suggest you do: Delete all existing indexing tables: occ memories:index --clear (is not work try nextcloud.occ memories:index --clear )

Force re-index all files: occ memories:index --force (is not work try nextcloud.occ memories:index --force)

Right now, after the long day at work, I can't think of any other suggestions.

I hope they help you & someone else

Many thanks FedeBx !!! Now I love my Nextcloud snap installation again ! In my case it works without re-indexing, the only advise I can give to others is to uninstall ffmpeg in case was installed previously as snap pakcage. I'm not 100% sure, but in my case regardless changes in paths (config.php) previews were not working until snap version of ffmpeg was removed and cron job for preview generator added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help wanted
Projects
None yet
Development

No branches or pull requests