immich icon indicating copy to clipboard operation
immich copied to clipboard

Recoded video - rotation wrong

Open Str1atum opened this issue 1 year ago • 1 comments

The bug

With 1.106.4 if have an issue with the recoded videos being the wrong orientation. It affects HEVC encoded videos in 1080p or 4k from iPhone 13 and 15. Videos in portrait orientation are rotated to landscape. Videos in landscape are rotated 180°. The videos do not just play that way in the browser but also when I download the recoded videos with Chrome to my local disk.

recode config is:

"ffmpeg": { "crf": 28, "threads": 0, "preset": "medium", "targetVideoCodec": "hevc", "acceptedVideoCodecs": [ "hevc" ], "targetAudioCodec": "aac", "acceptedAudioCodecs": [ "libopus", "mp3", "aac" ], "targetResolution": "720", "maxBitrate": "2500", "bframes": -1, "refs": 0, "gopSize": 0, "npl": 0, "temporalAQ": false, "cqMode": "auto", "twoPass": true, "preferredHwDevice": "auto", "transcode": "required", "tonemap": "hable", "accel": "qsv", "accelDecode": true

The OS that Immich Server is running on

Ubunti 24.04

Version of Immich Server

1.106.4

Version of Immich Mobile App

v.106

Platform with the issue

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

Your docker-compose.yml content

default

Your .env content

default

Reproduction steps

see above

Relevant log output

No response

Additional information

No response

Str1atum avatar Jun 20 '24 06:06 Str1atum

log output of two sample videos:

[32m[Nest] 7 - [39m06/20/2024, 8:34:15 AM [32m LOG[39m [33m[Microservices:MediaService][39m [32mStarted encoding video 196cae26-f6d7-43c0-afae-37a7f88864db {"inputOptions":["-hwaccel qsv","-hwaccel_output_format qsv","-async_depth 4","-threads 1"],"outputOptions":["-c:v hevc_qsv","-c:a copy","-movflags faststart","-fps_mode passthrough","-map 0:0","-map 0:1","-bf 7","-refs 5","-g 256","-tag:v hvc1","-v verbose","-vf scale_qsv=720:-1:async_depth=4:mode=hq,hwmap=derive_device=opencl,tonemap_opencl=desat=0:format=nv12:matrix=bt709:primaries=bt709:range=pc:tonemap=hable:transfer=bt709,hwmap=derive_device=qsv:reverse=1,format=qsv","-preset 4","-global_quality:v 28","-maxrate 2500","-bufsize 5000"],"twoPass":false}[39m

[32m[Nest] 7 - [39m06/20/2024, 8:34:16 AM [32m LOG[39m [33m[Microservices:MediaService][39m [32mSuccessfully encoded 196cae26-f6d7-43c0-afae-37a7f88864db[39m

[32m[Nest] 7 - [39m06/20/2024, 8:34:16 AM [32m LOG[39m [33m[Microservices:MediaService][39m [32mStarted encoding video 9fcbe395-fc0d-4933-8248-6d582fd6e255 {"inputOptions":["-hwaccel qsv","-hwaccel_output_format qsv","-async_depth 4","-threads 1"],"outputOptions":["-c:v hevc_qsv","-c:a copy","-movflags faststart","-fps_mode passthrough","-map 0:0","-map 0:1","-bf 7","-refs 5","-g 256","-tag:v hvc1","-v verbose","-vf scale_qsv=-1:720:async_depth=4:mode=hq,hwmap=derive_device=opencl,tonemap_opencl=desat=0:format=nv12:matrix=bt709:primaries=bt709:range=pc:tonemap=hable:transfer=bt709,hwmap=derive_device=qsv:reverse=1,format=qsv","-preset 4","-global_quality:v 28","-maxrate 2500","-bufsize 5000"],"twoPass":false}[39m

[32m[Nest] 7 - [39m06/20/2024, 8:34:18 AM [32m LOG[39m [33m[Microservices:MediaService][39m [32mSuccessfully encoded 9fcbe395-fc0d-4933-8248-6d582fd6e255[39m

Str1atum avatar Jun 20 '24 06:06 Str1atum