[PR #25079] fix: add setpts=N filter before fps=12 in thumbnail generation #18065

Open
opened 2026-02-05 16:32:04 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/25079
Author: @yuhuan417
Created: 1/6/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (3)

  • 4f72411 feat: add setpts=N filter before fps=12 in thumbnail generation
  • fea1df9 Merge branch 'main' into main
  • 83dd707 Merge branch 'main' into main

📊 Changes

2 files changed (+4 additions, -3 deletions)

View changed files

📝 server/src/services/media.service.spec.ts (+3 -3)
📝 server/src/utils/media.ts (+1 -0)

📄 Description

Description

Add setpts=N reassigns the timestamp(PTS) of every frame to match its sequential frame number after -skip_frame, it removes the time gaps, making the stream continuous.

It tricks subsequent filters (like thumbnail or reverse) into treating the sparse frames as a standard, tightly packed video, preventing buffer overlows and segmentation faults.

Fixes #24254

How Has This Been Tested?

Run new ffmpeg command line in docker container to confirm there is no segment fault.
Run immich thumbnail job on missing files, no error log.
Re-run immich thumbnail job on missing files, no new job to run.
Run tests in [server/src/services/media.service.spec.ts, all passed.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

Use gemini to help debug and explain ffmpeg parameters, modify code by hand.
...


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/25079 **Author:** [@yuhuan417](https://github.com/yuhuan417) **Created:** 1/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`4f72411`](https://github.com/immich-app/immich/commit/4f724116aa9f1daf38b37ea186618b7e01a4feaa) feat: add setpts=N filter before fps=12 in thumbnail generation - [`fea1df9`](https://github.com/immich-app/immich/commit/fea1df90bcac95adf1e633f5fc1dbc1d9f950a14) Merge branch 'main' into main - [`83dd707`](https://github.com/immich-app/immich/commit/83dd707fb520d85164b262c65df62dda600d27f0) Merge branch 'main' into main ### 📊 Changes **2 files changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `server/src/services/media.service.spec.ts` (+3 -3) 📝 `server/src/utils/media.ts` (+1 -0) </details> ### 📄 Description ## Description Add setpts=N reassigns the timestamp(PTS) of every frame to match its sequential frame number after -skip_frame, it removes the time gaps, making the stream continuous. <!--- Why is this change required? What problem does it solve? --> It tricks subsequent filters (like thumbnail or reverse) into treating the sparse frames as a standard, tightly packed video, preventing buffer overlows and segmentation faults. <!--- If it fixes an open issue, please link to the issue here. --> Fixes #24254 ## How Has This Been Tested? <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> Run new ffmpeg command line in docker container to confirm there is no segment fault. Run immich thumbnail job on missing files, no error log. Re-run immich thumbnail job on missing files, no new job to run. Run tests in [server/src/services/media.service.spec.ts, all passed. <!-- API endpoint changes (if relevant) ## API Changes No --> ## Checklist: - [x] I have performed a self-review of my own code - [x] I have made corresponding changes to the documentation if applicable - [x] I have no unrelated changes in the PR. - [x] I have confirmed that any new dependencies are strictly necessary. - [x] I have written tests for new code (if applicable) - [x] I have followed naming conventions/patterns in the surrounding code - [x] All code in `src/services/` uses repositories implementations for database calls, filesystem operations, etc. - [x] All code in `src/repositories/` is pretty basic/simple and does not have any immich specific logic (that belongs in `src/services/`) ## Please describe to which degree, if any, an LLM was used in creating this pull request. Use gemini to help debug and explain ffmpeg parameters, modify code by hand. ... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 16:32:04 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#18065