immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
53.5k stars 2.83k forks source link

Thumbnail not generating on few videos .MTS (not all) #13915

Closed adri1m64 closed 3 weeks ago

adri1m64 commented 1 month ago

The bug

image Hello,

My thumbnail are not generating on my .MTS videos (not all). It happens suddenly not after an update. Just few doesn't work on 1500 videos and 15000 photos.

Except this, Immich is incredible, my new baby.

Thank you so much

The OS that Immich Server is running on

Ubuntu 24.04.1 LTS

Version of Immich Server

v1.119.1

Version of Immich Mobile App

v1.119.1

Platform with the issue

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /mnt/backup2/videos:/mnt/videos  # Mapping des vidéos conservé
    env_file:
      - .env
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false
    networks:
      - reseau_global  # Référence au réseau externe existant

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false
    networks:
      - reseau_global  # Référence au réseau externe existant

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always
    networks:
      - reseau_global  # Référence au réseau externe existant

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command:
      [
        'postgres',
        '-c',
        'shared_preload_libraries=vectors.so',
        '-c',
        'search_path="$$user", public, vectors',
        '-c',
        'logging_collector=on',
        '-c',
        'max_wal_size=2GB',
        '-c',
        'shared_buffers=512MB',
        '-c',
        'wal_compression=on',
      ]
    restart: always
    networks:
      - reseau_global  # Référence au réseau externe existant

volumes:
  model-cache:

networks:
  reseau_global:
    external: true  # Indique que ce réseau est externe et ne doit pas être créé

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=Europe/Paris

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=Xxxxxxxxx

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

1. 2. 3. ...

Relevant log output

[Nest] 7  - 11/04/2024, 9:55:19 PM   ERROR [Microservices:MediaRepository] ffmpeg version 7.0.2-Jellyfin Copyright (c) 2000-2024 the FFmpeg developers

  built with gcc 12 (Debian 12.2.0-14)

  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto=auto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libharfbuzz --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc

  libavutil      59.  8.100 / 59.  8.100

  libavcodec     61.  3.100 / 61.  3.100

  libavformat    61.  1.100 / 61.  1.100

  libavdevice    61.  1.100 / 61.  1.100

  libavfilter    10.  1.100 / 10.  1.100

  libswscale      8.  1.100 /  8.  1.100

  libswresample   5.  1.100 /  5.  1.100

  libpostproc    58.  1.100 / 58.  1.100

[mpegts @ 0x505e4190180] parser not found for codec hdmv_pgs_subtitle, packets or times may be invalid.

    Last message repeated 1 times

[h264 @ 0x505e41e0580] Reinit context to 1440x1088, pix_fmt: yuv420p

Input #0, mpegts, from 'upload/library/admin/2013/20130330_113246.MTS':

  Duration: 00:00:07.30, start: 1.040000, bitrate: 9916 kb/s


  Program 1 

  Stream #0:0[0x1011]: Video: h264 (High), 1 reference frame (HDMV / 0x564D4448), yuv420p(top first, left), 1440x1080 [SAR 4:3 DAR 16:9], 25 fps, 50 tbr, 90k tbn

  Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s

  Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090), 1920x1080

[out#0/webp @ 0x505e4120f80] No explicit maps, mapping streams automatically...

[vost#0:0/libwebp_anim @ 0x505e4191980] Created video stream from input stream 0:0

[Parsed_thumbnail_1 @ 0x505e4181740] batch size: 12 frames

[Parsed_scale_5 @ 0x505e4180600] w:-2 h:250 flags:'lanczos+accurate_rnd+full_chroma_int' interl:0

[Parsed_fps_0 @ 0x505e4180f00] 0 frames in, 0 frames out; 0 frames dropped, 0 frames duplicated.

Correcting start time of Input #0 by 80000 us.

Stream mapping:

  Stream #0:0 -> #0:0 (h264 (native) -> webp (libwebp_anim))

[vost#0:0/libwebp_anim @ 0x505e4191980] Starting thread...

[vf#0:0 @ 0x505e4148740] Starting thread...

[vist#0:0/h264 @ 0x505e4060900] [dec:h264 @ 0x505e4061200] Starting thread...

[in#0/mpegts @ 0x505e4120280] Starting thread...

Press [q] to stop, [?] for help

[h264 @ 0x505e41e1980] Reinit context to 1440x1088, pix_fmt: yuv420p

[Parsed_thumbnail_1 @ 0x505e8050540] batch size: 12 frames

[Parsed_scale_5 @ 0x505e8050840] w:-2 h:250 flags:'lanczos+accurate_rnd+full_chroma_int' interl:0

[graph 0 input from stream 0:0 @ 0x505e80509c0] w:1440 h:1080 pixfmt:yuv420p tb:1/90000 fr:25/1 sar:4/3 csp:unknown range:unknown

[Parsed_fps_0 @ 0x505e80503c0] fps=12/1

[Parsed_scale_5 @ 0x505e8050840] w:1440 h:1080 fmt:yuv420p csp:unknown range:unknown sar:4/3 -> w:334 h:250 fmt:yuv420p csp:bt470bg range:pc sar:2000/1503 flags:0x00042200

[graph 0 input from stream 0:0 @ 0x505e80509c0] video frame properties congruent with link at pts_time: 0.52

[in#0/mpegts @ 0x505e4120280] EOF while reading input

[in#0/mpegts @ 0x505e4120280] Terminating thread with return code 0 (success)

[vist#0:0/h264 @ 0x505e4060900] [dec:h264 @ 0x505e4061200] Decoder thread received EOF packet

[Parsed_fps_0 @ 0x505e80503c0] Set first pts to 6

[vist#0:0/h264 @ 0x505e4060900] [dec:h264 @ 0x505e4061200] Decoder returned EOF, finishing

[vist#0:0/h264 @ 0x505e4060900] [dec:h264 @ 0x505e4061200] Terminating thread with return code 0 (success)

[vf#0:0 @ 0x505e4148740] Filtergraph returned EOF, finishing

[vf#0:0 @ 0x505e4148740] All consumers returned EOF

[vost#0:0/libwebp_anim @ 0x505e4191980] No filtered frames for output stream, trying to initialize anyway.

Output #0, webp, to 'upload/thumbs/f8e51f6d-e801-4cc7-9bfe-379578eadd34/f5/69/f569c073-7cf4-47f5-8be7-cf441d6e65e8-thumbnail.webp':

  Metadata:

    encoder         : Lavf61.1.100

  Stream #0:0: Video: webp, 1 reference frame, yuv420p(progressive), 334x250 [SAR 2000:1503 DAR 16:9], q=2-31, 200 kb/s, 12 fps, 1k tbn

      Metadata:

        encoder         : Lavc61.3.100 libwebp_anim

[out#0/webp @ 0x505e4120f80] Starting thread...

[Parsed_fps_0 @ 0x505e80503c0] 2 frames in, 0 frames out; 2 frames dropped, 0 frames duplicated.

[vost#0:0/libwebp_anim @ 0x505e4191980] Encoder thread received EOF

[libwebp encoder @ 0x505e50e0900] WebPAnimEncoderAssemble() failed with error: 1

[vost#0:0/libwebp_anim @ 0x505e4191980] Error submitting video frame to the encoder

[vost#0:0/libwebp_anim @ 0x505e4191980] Error flushing encoder: Cannot allocate memory

[vost#0:0/libwebp_anim @ 0x505e4191980] Task finished with error code: -12 (Cannot allocate memory)

[vost#0:0/libwebp_anim @ 0x505e4191980] Terminating thread with return code -12 (Cannot allocate memory)

[out#0/webp @ 0x505e4120f80] All streams finished

[out#0/webp @ 0x505e4120f80] Terminating thread with return code 0 (success)

[vf#0:0 @ 0x505e4148740] Terminating thread with return code 0 (success)

[AVIOContext @ 0x505e50e16c0] Statistics: 0 bytes written, 0 seeks, 0 writeouts

[out#0/webp @ 0x505e4120f80] Output file #0 (upload/thumbs/f8e51f6d-e801-4cc7-9bfe-379578eadd34/f5/69/f569c073-7cf4-47f5-8be7-cf441d6e65e8-thumbnail.webp):

[out#0/webp @ 0x505e4120f80]   Output stream #0:0 (video): 0 frames encoded; 0 packets muxed (0 bytes); 

[out#0/webp @ 0x505e4120f80]   Total: 0 packets (0 bytes) muxed

[out#0/webp @ 0x505e4120f80] video:0KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown

[out#0/webp @ 0x505e4120f80] Output file is empty, nothing was encoded(check -ss / -t / -frames parameters if used)

frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    

[in#0/mpegts @ 0x505e4120280] Input file #0 (upload/library/admin/2013/20130330_113246.MTS):

[in#0/mpegts @ 0x505e4120280]   Input stream #0:0 (video): 364 packets read (8225363 bytes); 2 frames decoded; 0 decode errors; 

[in#0/mpegts @ 0x505e4120280]   Total: 364 packets (8225363 bytes) demuxed

[AVIOContext @ 0x505e4060480] Statistics: 14684304 bytes read, 2 seeks

Conversion failed!

[Nest] 7  - 11/04/2024, 9:55:19 PM   ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-thumbnails): Error: ffmpeg exited with code 244: Conversion failed!

[Nest] 7  - 11/04/2024, 9:55:19 PM   ERROR [Microservices:JobService] Error: ffmpeg exited with code 244: Conversion failed!

    at ChildProcess.<anonymous> (/usr/src/app/node_modules/fluent-ffmpeg/lib/processor.js:180:22)

    at ChildProcess.emit (node:events:519:28)

    at ChildProcess._handle.onexit (node:internal/child_process:294:12)

[Nest] 7  - 11/04/2024, 9:55:19 PM   ERROR [Microservices:JobService] Object:

{

  "id": "f569c073-7cf4-47f5-8be7-cf441d6e65e8"

}

Additional information

No response

bo0tzz commented 1 month ago

The error is kind of strange. If you download one of the files with a broken thumbnail, can you view it locally on your computer? What sort of system are you running Immich on, and how much RAM does it have?

adri1m64 commented 1 month ago

Yes, even in Immich the video can be played and if i put my mouse on it shows me the preview, but only the thumbanil can't be generated.

Immich is in a docker in a linux in a proxmox, and the linux has 10 gb of ram

Lukasdotcom commented 3 weeks ago

I have that same problem. I attached a sample file that you can use. It's the same issue as #10979 I just misidentified it as failing to transcode. I fixed it for me by manually transcoding all the videos with ffmpeg into a mp4. 00465.MTS.zip

My system is Immich (v1.120.2) in a docker container running on a fedora 41 system with 64 GB of ram.