[BUG]: "Transcode missing" job won't catch videos, where only audio codec is undesired, because there are 0 Bytes transcodes from the previous version #2985

Closed
opened 2026-02-05 07:20:00 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @Hely0n on GitHub (Apr 20, 2024).

Originally assigned to: @mertalev on GitHub.

The bug

I have some videos, where the video codec is H264 but audio codec is something random.
There was this bug, that those weren't transcoded due to some ffmpeg flags, but with the current version, it should be fixed.

It indeed is fixed somehow. When I take one of those videos and click "refresh encoded-videos", it transcodes it successfully. But I have to add, that it only played on web after I hard reloaded with clearing cache (or maybe it took some time until the backend refreshed it). On mobile, it plays normally.

Now the real problem is, that I ran "transcode missing" and it didn't catch those videos.
I found out, that it's because I tried to transcode those videos in the previous version, where it created 0 bytes videos due to the bug. Now, the job skips those videos because there "exist"

My workaround will be to just transcode all again. But maybe it would be good if the algorithm for "Transcode missing" checks if the existent videos are not empty.

The OS that Immich Server is running on

Unraid

Version of Immich Server

v1.102.0

Version of Immich Mobile App

v1.101.0 build.147 (ios)

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

not relevant

Your .env content

not relevant

Reproduction steps

1. Have a video where video codec is h.264 and audio codec something not accepted
2. Set target codec to HEVC and AAC
3. Start "transcode missing"
4. You will notice, the videos in question are still not transcoded

But because this bug is due to created files of the previous version, I don't know how to recreate the behaviour exactly (you would have to place a 0bytes transcode for a video manually)

Relevant log output

not relevant

Additional information

No response

Originally created by @Hely0n on GitHub (Apr 20, 2024). Originally assigned to: @mertalev on GitHub. ### The bug I have some videos, where the video codec is H264 but audio codec is something random. There was this bug, that those weren't transcoded due to some ffmpeg flags, but with the current version, it should be fixed. It indeed is fixed somehow. When I take one of those videos and click "refresh encoded-videos", it transcodes it successfully. But I have to add, that it only played on web after I hard reloaded with clearing cache (or maybe it took some time until the backend refreshed it). On mobile, it plays normally. Now the real problem is, that I ran "transcode missing" and it didn't catch those videos. I found out, that it's because I tried to transcode those videos in the previous version, where it created 0 bytes videos due to the bug. Now, the job skips those videos because there "exist" My workaround will be to just transcode all again. But maybe it would be good if the algorithm for "Transcode missing" checks if the existent videos are not empty. ### The OS that Immich Server is running on Unraid ### Version of Immich Server v1.102.0 ### Version of Immich Mobile App v1.101.0 build.147 (ios) ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML not relevant ``` ### Your .env content ```Shell not relevant ``` ### Reproduction steps ```bash 1. Have a video where video codec is h.264 and audio codec something not accepted 2. Set target codec to HEVC and AAC 3. Start "transcode missing" 4. You will notice, the videos in question are still not transcoded But because this bug is due to created files of the previous version, I don't know how to recreate the behaviour exactly (you would have to place a 0bytes transcode for a video manually) ``` ### Relevant log output ```shell not relevant ``` ### Additional information _No response_
Author
Owner

@mertalev commented on GitHub (Apr 20, 2024):

The missing button uses the database - it doesn't check the files themselves. If a video doesn't get queued, it means the asset has a non-null value for encodedVideoPath. This field gets set at the very end after transcoding is complete, meaning it only gets set if there was no error.

Since the dashboard doesn't refresh that often, it can also be that it does get queued, but is skipped based on the transcode policy.

@mertalev commented on GitHub (Apr 20, 2024): The missing button uses the database - it doesn't check the files themselves. If a video doesn't get queued, it means the asset has a non-null value for `encodedVideoPath`. This field gets set at the very end after transcoding is complete, meaning it only gets set if there was no error. Since the dashboard doesn't refresh that often, it can also be that it does get queued, but is skipped based on the transcode policy.
Author
Owner

@mertalev commented on GitHub (Apr 20, 2024):

Ah, but we don't handle FFmpeg failures very well. If it ran and deleted a previously existing transcode and then threw an error, the result would be a 0 byte file that wouldn't get queued because it already had encodedVideoPath populated. Does that sound like this might be what happened?

@mertalev commented on GitHub (Apr 20, 2024): Ah, but we don't handle FFmpeg failures very well. If it ran and deleted a previously existing transcode and then threw an error, the result would be a 0 byte file that wouldn't get queued because it already had `encodedVideoPath` populated. Does that sound like this might be what happened?
Author
Owner

@Hely0n commented on GitHub (Apr 21, 2024):

Yes I would say, that's exactly the case

@Hely0n commented on GitHub (Apr 21, 2024): Yes I would say, that's exactly the case
Author
Owner

@wrapper commented on GitHub (Jul 9, 2024):

I have this problem, immich will not auto transcode videos added to my library but it will work if I manually 'Refresh encoded videos' (per video only)

@wrapper commented on GitHub (Jul 9, 2024): I have this problem, immich will not auto transcode videos added to my library but it will work if I manually 'Refresh encoded videos' (per video only)
Author
Owner

@Thinkscape commented on GitHub (Oct 15, 2024):

Because I had to re-encode bunch of videos to make them compatible with my family's devices, I ended up having bunch of broken assets.
I wrote a script that fixes it: https://gist.github.com/Thinkscape/b6196a17cefab450914a79f0f0b56292

Instructions for running inside docker:

  1. Exec into a container, i.e. with: docker exec -it c0nta1ner1d bash
  2. Copy or create the script and make it executable with: chmod +x script.sh
  3. Install deps with: apt update && apt install -y postgresql-client
  4. Run it and wait until finished.
  5. Go to Immich web and into Administration
  6. Go to Jobs and scroll down to TRANSCODE VIDEOS
  7. Click MISSING
@Thinkscape commented on GitHub (Oct 15, 2024): Because I had to re-encode bunch of videos to make them compatible with my family's devices, I ended up having bunch of broken assets. I wrote a script that fixes it: https://gist.github.com/Thinkscape/b6196a17cefab450914a79f0f0b56292 ### Instructions for running inside docker: 1. Exec into a container, i.e. with: `docker exec -it c0nta1ner1d bash` 2. Copy or create the script and make it executable with: `chmod +x script.sh` 3. Install deps with: `apt update && apt install -y postgresql-client` 4. Run it and wait until finished. 5. Go to Immich web and into Administration 6. Go to Jobs and scroll down to `TRANSCODE VIDEOS` 7. Click `MISSING`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2985