immich-app / immich

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

[BUG] Transcodes fail for 4k videos captured on Android with `Store Videos Efficiently` setting enabled #3012

Open mertalev opened 1 year ago

mertalev commented 1 year ago

The bug

The Store Videos Efficiently feature was introduced in Android 12 and is enabled by default on Google Pixel phones. In this setting, videos are stored as HEVC instead of H.264 and have an additional MetaHandle stream. ffprobe struggles to interpret these videos and fails with a moov atom not found error, particularly on 4K videos.

However, it is still possible for it to successfully transcode if the video is uploaded right after recording. In this case it does not raise an error, only warning Unsupported codec with id 0 for input stream 0 (referring to MetaHandle), and ffmpeg is able to transcode the video successfully.

Possible resolutions:

The OS that Immich Server is running on

-

Version of Immich Server

v1.63.2

Version of Immich Mobile App

v1.63.0

Platform with the issue

Your docker-compose.yml content

-

Your .env content

-

Reproduction steps

1. Enable `Store Videos Efficiently` on an Android phone running Android 12 or above.
2. Enable transcoding with the target video codec set to `h264` and resolution set to `1080p`.
3. Record a 4K video.
4. (optional) Wait for some time; behavior may differ between videos uploaded immediately and those that have existed for a period of time.
5. Upload it to the server.
6. Check the logs of `immich_microservices` to see whether transcoding succeeded.

Additional information

There are similar issues posted online concerning ffmpeg's handling of these videos, including here, here and here.

kt368 commented 6 months ago

I'm having the same problem. Google Pixel 7. When h.265 is specified in the camera settings, videos are not transcoded with Immich. If I switch to the h.264 - transcoding start to work for the new videos.

bshor commented 3 months ago

Same problem on Pixel 7 1080p/30. Whether or not I have HEVC selected.

The only solution is selecting 60fps AND no HEVC.