From 3d61a6be0627c71b1bd7365b539fdab220cd3150 Mon Sep 17 00:00:00 2001 From: naanlizard <7061721+naanlizard@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:42:32 +0000 Subject: [PATCH 1/2] Rename KeyframeOnlyIfNeed, update docs --- docs/transcoding/README.md | 19 +++++++++++-------- misc/conf_examples/Server.xml | 2 +- .../output_profiles/decodes/decodes.h | 6 +++--- src/projects/transcoder/transcoder_stream.cpp | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/transcoding/README.md b/docs/transcoding/README.md index b43e81ae8..8d6043a11 100644 --- a/docs/transcoding/README.md +++ b/docs/transcoding/README.md @@ -31,9 +31,8 @@ The `` setting allows incoming streams to be re-encoded via the ` Number of threads for the decoder. 2 - To reduce resource usage, only keyframes are decoded. - It is only activated when image encoding and video bypass are enabled. - false + By default, OME decodes all video frames. If OnlyKeyframes is true, only the keyframes will be decoded, massively improving thumbnail performance at the cost of having less control over when exactly they are generated + false --> @@ -341,7 +340,11 @@ The software decoder uses 2 threads by default. If the CPU speed is too low for ### Keyframe Decoding Only -If only thumbnails are used without video encoding, decoding all frames wastes CPU resources. By decoding only keyframes for thumbnails, resource usage can be reduced. However, the frame rate of the output image may not be accurate. Use the <**KeyFrameOnlyIfNeed>** option. Even if this value is set to true, if video encoding is enabled (Bypass is not included), all frames will be decoded. +For use cases without video (re)encoding, OME can be set to only decode the keyframes of incoming streams. This is a massive performance increase when all you are using the encoder for is generating thumbnails. + +To set OME to only decode keyframes, all of your encoder Output Profiles must be set to **true** set **true**. + +Supported since OvenmediaEngine version 0.18.0 ```xml @@ -350,17 +353,17 @@ If only thumbnails are used without video encoding, decoding all frames wastes C --> - false + true + jpeg 1280 diff --git a/misc/conf_examples/Server.xml b/misc/conf_examples/Server.xml index c9e001bbf..2b6b5be7e 100644 --- a/misc/conf_examples/Server.xml +++ b/misc/conf_examples/Server.xml @@ -319,7 +319,7 @@ To reduce resource usage, only keyframes are decoded. It is only activated when image encoding and video bypass are enabled. - false + false --> diff --git a/src/projects/config/items/virtual_hosts/applications/output_profiles/decodes/decodes.h b/src/projects/config/items/virtual_hosts/applications/output_profiles/decodes/decodes.h index eef61d0c1..c350a6b93 100644 --- a/src/projects/config/items/virtual_hosts/applications/output_profiles/decodes/decodes.h +++ b/src/projects/config/items/virtual_hosts/applications/output_profiles/decodes/decodes.h @@ -21,17 +21,17 @@ namespace cfg public: // Informal Option CFG_DECLARE_CONST_REF_GETTER_OF(GetThreadCount, _thread_count); - CFG_DECLARE_CONST_REF_GETTER_OF(IsKeyframeOnlyIfNeed, _keyframe_only_if_need); + CFG_DECLARE_CONST_REF_GETTER_OF(IsOnlyKeyframes, _only_keyframes); protected: void MakeList() override { Register("ThreadCount", &_thread_count); - Register("KeyframeOnlyIfNeed", &_keyframe_only_if_need); + Register("OnlyKeyframes", &_only_keyframes); } int32_t _thread_count = 2; - bool _keyframe_only_if_need = false; + bool _only_keyframes = false; }; } // namespace dec } // namespace app diff --git a/src/projects/transcoder/transcoder_stream.cpp b/src/projects/transcoder/transcoder_stream.cpp index fe2e259da..052123b05 100644 --- a/src/projects/transcoder/transcoder_stream.cpp +++ b/src/projects/transcoder/transcoder_stream.cpp @@ -799,7 +799,7 @@ bool TranscoderStream::CreateDecoder(MediaTrackId decoder_id, std::shared_ptrGetMediaType() == cmn::MediaType::Video && - GetOutputProfilesCfg()->GetDecodes().IsKeyframeOnlyIfNeed() == true) + GetOutputProfilesCfg()->GetDecodes().IsOnlyKeyframes() == true) { input_track->SetKeyframeDecodeOnly(IsKeyframeOnlyDecodable(_output_streams)); } From 5354e2fbec4147ca279140f2463d0cc2cd0a9d7c Mon Sep 17 00:00:00 2001 From: naanlizard <7061721+naanlizard@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:51:57 +0000 Subject: [PATCH 2/2] tweak docs --- docs/transcoding/README.md | 17 +++++++++-------- misc/conf_examples/Server.xml | 12 +++++++++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/docs/transcoding/README.md b/docs/transcoding/README.md index 8d6043a11..e96ba8f87 100644 --- a/docs/transcoding/README.md +++ b/docs/transcoding/README.md @@ -348,16 +348,17 @@ Supported since OvenmediaEngine version 0.18.0 ```xml - - + + - true - + true + diff --git a/misc/conf_examples/Server.xml b/misc/conf_examples/Server.xml index 2b6b5be7e..1cef38b9f 100644 --- a/misc/conf_examples/Server.xml +++ b/misc/conf_examples/Server.xml @@ -309,7 +309,17 @@ live - + + + + true +