xemle / home-gallery

Self-hosted open-source web gallery to view your photos and videos featuring mobile-friendly, tagging and AI powered image discovery
https://home-gallery.org
MIT License
836 stars 64 forks source link

Any way to turn off preview generation and only use thumbnails? #145

Open austonpramodh opened 4 months ago

austonpramodh commented 4 months ago

Hi,

This project looks awesome, I am using it on a Raspberry Pi.

Is there any way to turn off the initial Preview generation,. like the ffmpeg takes forever, even after using raspberry pi GPU config.

  video:
    previewSize: 720 # used as preview size and preview filename
    ext: mp4 # used as target video container and preview filename
    scale: -2:'min(720,ih)' # overwrites previewSize. E.g. -2:'min(ih,max(720,min(1080,ih*.5)))' for 720p <= height*0.5 <= 1080p or height, if height < 720
    # scale: trunc(min(max(iw\,ih*dar)\,720)/2)*64:trunc(ow/dar/2)*2
    frameRate: 30
    maxVideoBitRate: 4000 # in KB
    videoEncoder: h264_v4l2m2m
    preset: fast
    profile: 0

would it be possible to just use thumbnails instead of video preview?

xemle commented 4 months ago

This project looks awesome, I am using it on a Raspberry Pi.

Thank you and awesome!

Currently it is not supported by default to disable the preview generation of videos. Maybe there is a ffmpeg setting only to transcode the first second or so?

would it be possible to just use thumbnails instead of video preview?

What issue are you facing exactly because I do not understand the issue? Does the preview calculation take to long time? Is the time factor limited to videos only or also for images? Would you still like to import videos or why would you show only thumbnails?

You could exclude video files by file index exclude patterns or exclude larger files by file index max file size filter if that might solve your issue.

xemle commented 3 months ago

I am happy to announce the first experimental plugin feature in the current master! See docs.home-gallery.org/plugin for further details!

With it you can disable the video extractor in the configuration and no video preview will be processed.

austonpramodh commented 3 months ago

I am sorry i completely lost track.

So I am trying to deploy on Raspberry Pi, I tried using h264_v4l2m2m, but seems too slow for me, at least to test. and it seems like before processing all the videos, the videos don't become available.

I am gonna try out the plugin stuff soon, sometime this weekend. Good work though I appreciate it.


if anyone wants to get along, here's my config. havent got it 100% working. The videos seem to be broken after ffmeg thingy.

config

  video:
    previewSize: 720 # used as preview size and preview filename
    ext: mp4 # used as target video container and preview filename
    scale: -2:'min(720,ih)' # overwrites previewSize. E.g. -2:'min(ih,max(720,min(1080,ih*.5)))' for 720p <= height*0.5 <= 1080p or height, if height < 720
    # scale: trunc(min(max(iw\,ih*dar)\,720)/2)*64:trunc(ow/dar/2)*2
    frameRate: 30
    maxVideoBitRate: 4000 # in KB
    videoEncoder: h264_v4l2m2m
    preset: fast
    profile: 0

docker compose file

services:
  gallery1:
    image: xemle/home-gallery
    user: "${UID}:${GID}"
    environment:
      - GALLERY_API_SERVER=http://api:3000
      - GALLERY_API_SERVER_CONCURRENT=1 # for SoC devices like Rasperry Pi. Use 5 otherwise
      - GALLERY_API_SERVER_TIMEOUT=60 # for SoC devices like Rasperry Pi. Use 30 otherwise
      #- GALLERY_USE_NATIVE=ffprobe,ffmpeg,vipsthumbnail # On issues with sharp resizer
      - GALLERY_OPEN_BROWSER=false
      # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
      - GALLERY_WATCH_POLL_INTERVAL=300
    devices:
      - /dev/video10:/dev/video10
      - /dev/video11:/dev/video11
      - /dev/video12:/dev/video12
    volumes:
      - ./data:/data
    ports:
      - "3099:3000"
    entrypoint: [ 'node', '/app/gallery.js' ]
    command: [ 'run', 'server' ]

You would need to adduser to video group though, I am running on ubuntu 22.04

xemle commented 3 months ago

@austonpramodh Another question: Why would you transcode videos on a Raspberry Pi? For an initial setup of a larger media collection I recommend using a desktop machine since all the preview generation and video transcoding requires some CPU cycles and therefore time.

Later you can copy/rsync the storage folder with the previews to your Rasperry Pi and new media can be transcoded there.

BTW There is also a fetch command to fetch gallery data from one remote gallery to a local one. For example I do have a NAS with a OKish CPU and a Rasperry Pi. The gallery was created on the NAS but the gallery is served from the Raspberry Pi and fetches the data from the NAS.

austonpramodh commented 2 months ago

Well, it looks like you are right, and I already did it. I switched to Intel N95. I am going to sometime implement home gallery on Intel N95 and utilize Intel QuickSync. Ill keep you posted.

But Raspberry Pi, ill still be working with single video just to test, I am interested in seeing the speeds. Not sure if I can though, but yeah ill keep posted.