immich icon indicating copy to clipboard operation
immich copied to clipboard

Video rotation wrong when played back.

Open kaaku3 opened this issue 1 year ago • 9 comments

The bug

Videos recorded in portrait mode are played back in landscape mode in both web and app. Preview image is the correct rotation.

Downloading the video then playing locally is played back correctly.

The OS that Immich Server is running on

Armbian

Version of Immich Server

1.103.1

Version of Immich Mobile App

1.103.1

Platform with the issue

  • [ ] Server
  • [X] Web
  • [X] Mobile

Your docker-compose.yml content

version: "3.8"

#
# 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}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
#   network_mode: "host"
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
      file: hwaccel.transcoding.yml
      service: rkmpp # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
#   network_mode: "host"
    restart: always

  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:
      file: hwaccel.ml.yml
      service: armnn # 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
#   network_mode: "host"
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:afb290a0a0d0b2bd7537b62ebff1eb84d045c757c1c31ca2ca48c79536c0de82
#   network_mode: "host"
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
#   network_mode: "host"
    restart: always

volumes:
  pgdata:
  model-cache:

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 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
DB_PASSWORD=

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

REDIS_HOSTNAME=immich_redis

Reproduction steps

1. record video on phone in portrait mode
2. play back in app or web and its the wrong orientation.
3.
...

Relevant log output

No response

Additional information

No response

kaaku3 avatar May 04 '24 02:05 kaaku3

Maybe good to provide a sample video file as I cannot reproduce. Tried on mobile and on web, with videos shot in landscape and in portrait (using Android). Both play back fine in the expected orientation.

opbod avatar May 04 '24 20:05 opbod

I'm away right now so cannot provide a video easily, but I just did some testing after seeing your message. If I disable hardware transcoding (rkmpp). Then orientation is correct. I'll upload my settings file. Software transcoding is too slow on this soc (rk3588s) to be usable immich-config.txt

kaaku3 avatar May 05 '24 00:05 kaaku3

cc: @fyfrey have you had any issues with rotation?

jrasm91 avatar May 05 '24 00:05 jrasm91

Yeah, I also got some videos that are played upside down (only in immich, fine in other players)

fyfrey avatar May 05 '24 06:05 fyfrey

I've disabled transcoding for the time being and orientation is correct. Only downside is on slow mobile data videos are slow to load in the app.

kaaku3 avatar May 05 '24 07:05 kaaku3

Do you need to reload all videos for it to play correct?

sbkg0002 avatar May 06 '24 07:05 sbkg0002

I don't know if I did it the correct way, but I just removed the encoded videos folder, changed the settings then reran the transcoding job on all. I currently have gone back to software transcoding again as without transcoding to a lower resolution playback on mobile data is not very usable on my network, but at its current speed it will take a month to transcode all my videos, where as hardware transcoding finishes in a few hours. I can confirm in my case the video orientation is only wrong on videos encoded using rkmpp with hevc, i have not tried other hardware transcoding codecs, but my soc only supports x265 and x264 hardware encoding. I did need to delete the browser cache to playback correctly in web gui.

kaaku3 avatar May 06 '24 09:05 kaaku3

After 1.106.1 update. video orientation is still wrong when hardware decode for rkmpp is enabled. When hardware encode is enabled but hardware decode is disabled, orientation is correct but the colour is washed out and green bands on the transcoded video.

kaaku3 avatar Jun 11 '24 11:06 kaaku3

I'm having the same issue but with QSV hardware decode/encode. It seems that it affect only HEVC/x265, not x264. (Also it seems to be the same issue as #10498 )

Here is a sample video affected, for testing https://github.com/immich-app/immich/assets/26034461/ee65c43d-6c57-46ce-8a5b-9417468a726b

Running Immich 1.106.4

nhy42 avatar Jul 01 '24 00:07 nhy42