immich-app / immich

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

[BUG] Videos with incompatible audio codec (twos) won't get transcoded despite policy #8603

Closed Hely0n closed 4 months ago

Hely0n commented 4 months ago

The bug

I just found out that videos of a specific vacation can't be played anywhere, even if I have "transcode videos not in desired format" enabled.

I found out that the video codec is h264, but the audio codec is "twos". Immich didn't respect that and thus didn't transcode it.

I looked into the code and I suspect that ffprobe is crashing by trying to look up the audio codec. I started the "transcode missing" job again and there were some erros in the logs like:

[Nest] 238  - 04/07/2024, 10:15:13 PM   ERROR [JobService] Unable to run job handler (videoConversion/video-conversion): Error: ffprobe exited with code 1
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 @ 0x24134170000] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x24134170000] moov atom not found
/photos/encoded-video/ab0f2731-35bf-45de-9b0f-d311d0eaac53/54/2a/542a5499-b7d6-4968-a4ee-c277668f1fcc-MP.mp4: Invalid data found when processing input
[Nest] 238  - 04/07/2024, 10:15:13 PM   ERROR [JobService] Error: ffprobe exited with code 1
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 @ 0x24134170000] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x24134170000] moov atom not found
/photos/encoded-video/ab0f2731-35bf-45de-9b0f-d311d0eaac53/54/2a/542a5499-b7d6-4968-a4ee-c277668f1fcc-MP.mp4: Invalid data found when processing input
    at ChildProcess.<anonymous> (/app/immich/server/node_modules/fluent-ffmpeg/lib/ffprobe.js:233:22)
    at ChildProcess.emit (node:events:518:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)
[Nest] 238  - 04/07/2024, 10:15:13 PM   ERROR [JobService] Object:
{
  "id": "5c221599-4cf1-4120-a676-848dfd3785bb"
}

But I have like 6k video assets, so I can't assure that these errors are coming from the videos in question (coudn't find assets with the ID)

The OS that Immich Server is running on

Unraid

Version of Immich Server

v1.101.0

Version of Immich Mobile App

v1.101.0

Platform with the issue

Your docker-compose.yml content

Not important

Your .env content

Not important

Reproduction steps

1. I post a test video on the contributing discord channel linked to this issue, but you can also DM me for it
2. Set transcode policy to "Not in desired format"
3. Start the transcode job with the video in the library
...

Additional information

No response

mertalev commented 4 months ago

Hi, I don’t think the error here is actually related to the twos codec or transcode policy. It’s this error: moov atom not found, which is tracked in #2948 and #6834.