[PR #11689] Workaround ffmpeg keyframe seeking for external subtitles #12972

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

Original Pull Request: https://github.com/jellyfin/jellyfin/pull/11689

State: closed
Merged: Yes


We seek to the exact position of the keyframe for direct stream/remuxing, but FFmpeg seeks to the previous keyframe when the exact time is provided as input. To work around this, add a 0.5 second offset to the seeking time so that the correct keyframe is returned for most videos.

This is probably not the most correct way to handle this, but I found that it might be the only way to include this in the 10.9 branch. Other approaches might require either significant changes to the server or an API change.

This does not solve desyncing after transcoding for some video files, but I haven't found a good way to fix those yet due to the complexity of different encoders' outputs. Maybe adding an option to force burn-in subtitles during transcoding could be a good workaround? Currently, client settings enforce burn-in in all situations when set.

Changes

  • add 0.5s offset to seek position for direct stream/remuxing

Issues

Fixes #11567

Partially Fixes #2547

**Original Pull Request:** https://github.com/jellyfin/jellyfin/pull/11689 **State:** closed **Merged:** Yes --- We seek to the exact position of the keyframe for direct stream/remuxing, but FFmpeg seeks to the previous keyframe when the exact time is provided as input. To work around this, add a 0.5 second offset to the seeking time so that the correct keyframe is returned for most videos. This is probably not the most correct way to handle this, but I found that it might be the only way to include this in the 10.9 branch. Other approaches might require either significant changes to the server or an API change. This does not solve desyncing after transcoding for some video files, but I haven't found a good way to fix those yet due to the complexity of different encoders' outputs. Maybe adding an option to force burn-in subtitles during transcoding could be a good workaround? Currently, client settings enforce burn-in in all situations when set. <!-- Ensure your title is short, descriptive, and in the imperative mood (Fix X, Change Y, instead of Fixed X, Changed Y). For a good inspiration of what to write in commit messages and PRs please review https://chris.beams.io/posts/git-commit/ and our documentation. --> **Changes** <!-- Describe your changes here in 1-5 sentences. --> - add 0.5s offset to seek position for direct stream/remuxing **Issues** <!-- Tag any issues that this PR solves here. ex. Fixes # --> Fixes #11567 Partially Fixes #2547
OVERLORD added the pull-request label 2026-02-07 07:05:00 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#12972