[PR #6600] [MERGED] Add first draft of keyframe extraction for Matroska #11051

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

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/6600
Author: @cvium
Created: 9/23/2021
Status: Merged
Merged: 1/20/2022
Merged by: @crobibero

Base: masterHead: keyframe_extraction_v1


📝 Commits (10+)

📊 Changes

37 files changed (+20854 additions, -119 deletions)

View changed files

📝 Emby.Server.Implementations/ApplicationHost.cs (+4 -0)
📝 Jellyfin.Api/Controllers/DynamicHlsController.cs (+40 -115)
📝 Jellyfin.Api/Jellyfin.Api.csproj (+1 -0)
📝 Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs (+10 -0)
📝 Jellyfin.Server/Jellyfin.Server.csproj (+1 -0)
📝 Jellyfin.Server/Startup.cs (+3 -0)
📝 Jellyfin.sln (+28 -4)
📝 MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs (+6 -0)
📝 MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs (+3 -0)
📝 MediaBrowser.Model/Configuration/EncodingOptions.cs (+5 -0)
src/Jellyfin.MediaEncoding.Hls/Cache/CacheDecorator.cs (+96 -0)
src/Jellyfin.MediaEncoding.Hls/Extensions/MediaEncodingHlsServiceCollectionExtensions.cs (+36 -0)
src/Jellyfin.MediaEncoding.Hls/Extractors/FfProbeKeyframeExtractor.cs (+58 -0)
src/Jellyfin.MediaEncoding.Hls/Extractors/IKeyframeExtractor.cs (+24 -0)
src/Jellyfin.MediaEncoding.Hls/Extractors/MatroskaKeyframeExtractor.cs (+48 -0)
src/Jellyfin.MediaEncoding.Hls/Jellyfin.MediaEncoding.Hls.csproj (+31 -0)
src/Jellyfin.MediaEncoding.Hls/Playlist/CreateMainPlaylistRequest.cs (+56 -0)
src/Jellyfin.MediaEncoding.Hls/Playlist/DynamicHlsPlaylistGenerator.cs (+204 -0)
src/Jellyfin.MediaEncoding.Hls/Playlist/IDynamicHlsPlaylistGenerator.cs (+14 -0)
src/Jellyfin.MediaEncoding.Hls/ScheduledTasks/KeyframeExtractionScheduledTask.cs (+111 -0)

...and 17 more files

📄 Description

Changes
All video formats supported with ffprobe (slow), matroska metadata supported (pretty fast)

  • Added a config option in encoding.xml to allow specific container formats to have its keyframes extracted.
  <AllowOnDemandMetadataBasedKeyframeExtractionForExtensions>
    <string>mkv</string>
  </AllowOnDemandMetadataBasedKeyframeExtractionForExtensions>
  • Very simple Matroska parser to extract the keyframe positions.
  • Fallback to the old dynamic segment calculator.

Thoughts:

  • Should the option be library specific rather than global?
  • Should we allow the frame based tools on demand? They are super slow especially over network storage.

🔄 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/jellyfin/jellyfin/pull/6600 **Author:** [@cvium](https://github.com/cvium) **Created:** 9/23/2021 **Status:** ✅ Merged **Merged:** 1/20/2022 **Merged by:** [@crobibero](https://github.com/crobibero) **Base:** `master` ← **Head:** `keyframe_extraction_v1` --- ### 📝 Commits (10+) - [`9c15f96`](https://github.com/jellyfin/jellyfin/commit/9c15f96e12a0d48a70cbca8380bf78a4f2512b03) Add first draft of keyframe extraction for Matroska - [`3531dc8`](https://github.com/jellyfin/jellyfin/commit/3531dc85ae49b8289b572c7c62f50a328ec7c344) Fix build - [`6e77d50`](https://github.com/jellyfin/jellyfin/commit/6e77d5056359ff8581ef00dc02b029286177d59b) Remove path hinting - [`d995f0e`](https://github.com/jellyfin/jellyfin/commit/d995f0e092f997930e6561a343072c26f100bb35) Add dto changes - [`30230af`](https://github.com/jellyfin/jellyfin/commit/30230aff73271acb521c427f9815df6adf1814bb) Fix build? - [`ee8bd9b`](https://github.com/jellyfin/jellyfin/commit/ee8bd9b3b5c41a4eed642477a6b33b56c1ee0741) Fix xmldoc issues - [`35c0801`](https://github.com/jellyfin/jellyfin/commit/35c0801d6cd1def0f8c50b7e892e04b56d7abbb1) More fixes - [`be233b4`](https://github.com/jellyfin/jellyfin/commit/be233b49b610fafb63572dc9dc5325bf27cd72ac) Fixes - [`fa38b74`](https://github.com/jellyfin/jellyfin/commit/fa38b741ce2b3438f5ae29273b423bd7fe2b25f6) Restructure the code to make it more testable - [`c7b25a9`](https://github.com/jellyfin/jellyfin/commit/c7b25a9fe466083a761dc768169e09f68313f862) Add first test ### 📊 Changes **37 files changed** (+20854 additions, -119 deletions) <details> <summary>View changed files</summary> 📝 `Emby.Server.Implementations/ApplicationHost.cs` (+4 -0) 📝 `Jellyfin.Api/Controllers/DynamicHlsController.cs` (+40 -115) 📝 `Jellyfin.Api/Jellyfin.Api.csproj` (+1 -0) 📝 `Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs` (+10 -0) 📝 `Jellyfin.Server/Jellyfin.Server.csproj` (+1 -0) 📝 `Jellyfin.Server/Startup.cs` (+3 -0) 📝 `Jellyfin.sln` (+28 -4) 📝 `MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs` (+6 -0) 📝 `MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs` (+3 -0) 📝 `MediaBrowser.Model/Configuration/EncodingOptions.cs` (+5 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Cache/CacheDecorator.cs` (+96 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Extensions/MediaEncodingHlsServiceCollectionExtensions.cs` (+36 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Extractors/FfProbeKeyframeExtractor.cs` (+58 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Extractors/IKeyframeExtractor.cs` (+24 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Extractors/MatroskaKeyframeExtractor.cs` (+48 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Jellyfin.MediaEncoding.Hls.csproj` (+31 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Playlist/CreateMainPlaylistRequest.cs` (+56 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Playlist/DynamicHlsPlaylistGenerator.cs` (+204 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/Playlist/IDynamicHlsPlaylistGenerator.cs` (+14 -0) ➕ `src/Jellyfin.MediaEncoding.Hls/ScheduledTasks/KeyframeExtractionScheduledTask.cs` (+111 -0) _...and 17 more files_ </details> ### 📄 Description <!-- 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** All video formats supported with ffprobe (slow), matroska metadata supported (pretty fast) - Added a config option in `encoding.xml` to allow specific container formats to have its keyframes extracted. ``` <AllowOnDemandMetadataBasedKeyframeExtractionForExtensions> <string>mkv</string> </AllowOnDemandMetadataBasedKeyframeExtractionForExtensions> ``` - Very simple Matroska parser to extract the keyframe positions. - Fallback to the old dynamic segment calculator. Thoughts: - Should the option be library specific rather than global? - Should we allow the frame based tools on demand? They are super slow especially over network storage. --- <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-07 06:31:30 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#11051