immich-app / immich

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

[BUG] Timeline endpoint returns the wrong video duration #10007

Closed RWDai closed 2 weeks ago

RWDai commented 2 months ago

The bug

The api/timeline/bucket retruns here

iShot_2024-06-06_13 14 56

But the actual video duration。

iShot_2024-06-06_13 15 48

Test video shot by a7c2。

The OS that Immich Server is running on

unraid

Version of Immich Server

v1.105.1

Version of Immich Mobile App

none

Platform with the issue

Your docker-compose.yml content

version: '3.8'
services:
  postgres:
    container_name: postgres
    # image: postgres
    image: tensorchord/pgvecto-rs:pg16-v0.2.0
    restart: always
    # ports:
    #   - 5432:5432
    volumes:
      - /mnt/user/appdata/postgresql/data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=xxxx
      - POSTGRES_USER=xxx
      - POSTGRES_PASSWORD=xxx

  redis:
    container_name: redis
    image: redis:latest
    restart: always
    volumes:
      - /mnt/user/appdata/redis/data:/data
      - /mnt/user/appdata/redis/redis.conf:/usr/local/etc/redis/redis.conf
    command: redis-server /usr/local/etc/redis/redis.conf

  nextcloud:
    container_name: nextcloud
    image: nextcloud
    restart: always
    ports:
      - 18086:80
    volumes:
      - /mnt/user/appdata/nextcloud/html:/var/www/html
      - /mnt/user/appdata/nextcloud/apps:/var/www/html/custom_apps
      - /mnt/user/appdata/nextcloud/config:/var/www/html/config
      - /mnt/user/appdata/nextcloud/data:/var/www/html/data
    environment:
      - POSTGRES_HOST=xxx
      - POSTGRES_DB=xxx
      - POSTGRES_USER=xx
      - POSTGRES_PASSWORD=xx
      - NEXTCLOUD_ADMIN_PASSWORD=xxx
      - NEXTCLOUD_ADMIN_USER=xx
    depends_on:
      - postgres

  code:
    container_name: nextcloud-code
    ports:
      - 18087:9980
    environment:
      - DONT_GEN_SSL_CERT=yes 
      - extra_params=--o:ssl.enable=false  
      - username=xxxx
      - password=xxxxx
    restart: always
    depends_on:
      - nextcloud
    image: collabora/code

  immich:
    container_name: immich-server
    image: ghcr.io/immich-app/immich-server:release
    restart: always
    ports:
      - 2283:3001
    volumes:
     - /mnt/user/appdata/immich/upload:/usr/src/app/upload
     - /mnt/user/Photo:/mnt/media/photo:ro
     - /etc/localtime:/etc/localtime:ro
    environment:
      - DB_HOSTNAME=postgres
      - DB_USERNAME=xxxx
      - DB_PASSWORD=xxxx
      - DB_DATABASE_NAME=immich
      - DB_PORT=5432
      - REDIS_HOSTNAME=redis
      - REDIS_PORT=6379
    depends_on:
      - postgres
      - redis
    command: ['start.sh', 'immich']

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:release
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
                - compute
                - video
    command: ['start.sh', 'microservices']
    volumes:
      - /mnt/user/appdata/immich/upload:/usr/src/app/upload
      - /mnt/user/Photo:/mnt/media/photo:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - DB_HOSTNAME=postgres
      - DB_USERNAME=xxxx
      - DB_PASSWORD=xxxx
      - DB_DATABASE_NAME=immich
      - DB_PORT=5432
      - REDIS_HOSTNAME=redis
      - REDIS_PORT=6379
    depends_on:
      - postgres
      - redis
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:release
    # image: ghcr.io/immich-app/immich-machine-learning:release-cuda
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
    volumes:
      - /mnt/user/appdata/immich/ml-cache:/cache
    restart: always

Your .env content

none

Reproduction steps

1. This test vedio is at external library(/mnt/user/Photo:/mnt/media/photo)。

Relevant log output

No response

Additional information

No response

bo0tzz commented 2 months ago

Can you post the output of running ffprobe on this file?

RWDai commented 2 months ago
root@b4c1c32ab965:/mnt/media/photo/2024-06-05# ffprobe C0022.MP4
ffprobe version 6.0.1-Jellyfin Copyright (c) 2007-2023 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 --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --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      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ac64c7e6c0] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ac64c7e6c0] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C0022.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 17506303
    compatible_brands: XAVCmp42iso6
    creation_time   : 2024-06-05T09:23:55.000000Z
  Duration: 00:00:27.36, start: 0.000000, bitrate: 78535 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 49959 kb/s, 50 fps, 50 tbr, 50k tbn (default)
    Metadata:
      creation_time   : 2024-06-05T09:23:55.000000Z
      handler_name    : Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
    Side data:
      displaymatrix: rotation of 90.00 degrees
  Stream #0:1[0x2](und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2024-06-05T09:23:55.000000Z
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Data: none (rtmd / 0x646D7472), 7782 kb/s (default)
    Metadata:
      creation_time   : 2024-06-05T09:23:55.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 00:13:47:02
Unsupported codec with id 0 for input stream 2

Duration: 00:00:27.36 Looks like nothing's wrong

bo0tzz commented 2 weeks ago

Duplicate of #8244