Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to extract keyframe only during trickplay image generation #11511

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

gnattu
Copy link
Member

@gnattu gnattu commented May 8, 2024

This would be significantly faster than decoding every frame, but it does have compatibility issues. Not all decoders support this mode, notably the VP9 decoder, CUVID decoders, and QSV decoders.

Some videos with very long key-frame intervals may also perform poorly with this mode, as the image timing could become too inaccurate to reflect the actual frame.

Changes

  • Add EnableKeyFrameOnlyExtraction option to TrickplayOptions

Issues

Fixes #11336

Web: jellyfin/jellyfin-web#5800

Copy link

github-actions bot commented May 8, 2024

Changes in OpenAPI specification found. Expand to see details.

What's Changed


GET /System/Configuration
Return Type:

Changed response : 200 OK

Application configuration returned.

  • Changed content type : application/json

    • Changed property TrickplayOptions (object)

      Gets or sets the trickplay options.

      Updated TrickplayOptions :

      • Added property EnableKeyFrameOnlyExtraction (boolean)

        Gets or sets a value indicating whether to only extract key frames.
        Significantly faster, but is not compatible with all decoders and/or video files.

  • Changed content type : application/json; profile="CamelCase"

    • Changed property TrickplayOptions (object)

      Gets or sets the trickplay options.

      Updated TrickplayOptions :

      • Added property EnableKeyFrameOnlyExtraction (boolean)

        Gets or sets a value indicating whether to only extract key frames.
        Significantly faster, but is not compatible with all decoders and/or video files.

  • Changed content type : application/json; profile="PascalCase"

    • Changed property TrickplayOptions (object)

      Gets or sets the trickplay options.

      Updated TrickplayOptions :

      • Added property EnableKeyFrameOnlyExtraction (boolean)

        Gets or sets a value indicating whether to only extract key frames.
        Significantly faster, but is not compatible with all decoders and/or video files.

POST /System/Configuration
Request:

Changed content type : application/json

Updated ServerConfiguration :

  • Changed property TrickplayOptions (object)

    Gets or sets the trickplay options.

    Updated TrickplayOptions :

    • Added property EnableKeyFrameOnlyExtraction (boolean)

      Gets or sets a value indicating whether to only extract key frames.
      Significantly faster, but is not compatible with all decoders and/or video files.

Changed content type : text/json

Updated ServerConfiguration :

  • Changed property TrickplayOptions (object)

    Gets or sets the trickplay options.

    Updated TrickplayOptions :

    • Added property EnableKeyFrameOnlyExtraction (boolean)

      Gets or sets a value indicating whether to only extract key frames.
      Significantly faster, but is not compatible with all decoders and/or video files.

Changed content type : application/*+json

Updated ServerConfiguration :

  • Changed property TrickplayOptions (object)

    Gets or sets the trickplay options.

    Updated TrickplayOptions :

    • Added property EnableKeyFrameOnlyExtraction (boolean)

      Gets or sets a value indicating whether to only extract key frames.
      Significantly faster, but is not compatible with all decoders and/or video files.

@gnattu gnattu added the enhancement Improving an existing function, or small fixes label May 8, 2024
@jellyfin-bot
Copy link
Contributor

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

@jellyfin-bot jellyfin-bot added the merge conflict Merge conflicts should be resolved before a merge label May 15, 2024
@jellyfin-bot jellyfin-bot removed the merge conflict Merge conflicts should be resolved before a merge label May 16, 2024
@gnattu gnattu marked this pull request as ready for review July 16, 2024 15:39
@gnattu
Copy link
Member Author

gnattu commented Jul 16, 2024

One more question for the handling: this mode is not compatible with a lot of hardware decoders. Should we add a whitelist to the server and force software decoding when this option is set and current hardware acceleration method is not compatible with this mode?

@gnattu gnattu requested a review from a team July 16, 2024 15:40
@crobibero
Copy link
Member

Should we add a whitelist to the server and force software decoding when this option is set and current hardware acceleration method is not compatible with this mode?

I think if we know that there is a specific set of configurations that this new setting works with we should add a whitelist.

Also please be sure to PR the docs for next server release

@nyanmisaka
Copy link
Member

Not all decoders support this mode, notably the VP9 decoder, CUVID decoders, and QSV decoders.

If FFmpeg's native software decoder supports AVDISCARD_NONKEY, then its corresponding hw accelerator should also support it. Hw decoder usually do not, unless they implement it separately.

So the following are exceptions:

  • QSV w/ (Prefer OS native DXVA or VA-API hardware decoders)
  • NVENC w/ (Enable enhanced NVDEC decoder)
  • AMF, uses d3d11va on Windows.

@gnattu gnattu requested a review from nyanmisaka July 16, 2024 16:36
This would be significantly faster than decoding every frame, but it does have compatibility issues. Not all decoders support this mode, notably the VP9 decoder, CUVID decoders, and QSV decoders.

Some videos with very long key-frame intervals may also perform poorly with this mode, as the image timing could become too inaccurate to reflect the actual frame.

Signed-off-by: gnattu <gnattuoc@me.com>
…me only mode but requested by user

Signed-off-by: gnattu <gnattuoc@me.com>
Signed-off-by: gnattu <gnattuoc@me.com>
Co-authored-by: Nyanmisaka <nst799610810@gmail.com>
@crobibero
Copy link
Member

Don't forget to make the web change also (or at least create an issue to track it)

@gnattu
Copy link
Member Author

gnattu commented Jul 17, 2024

Already here: jellyfin/jellyfin-web#5800

but will not build until the sdk is updated to include the api changes.

@crobibero crobibero merged commit c207404 into master Jul 17, 2024
15 checks passed
@crobibero crobibero deleted the trickplay-keyframe-only branch July 17, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing function, or small fixes
Projects
Status: Done
5 participants