The PR #10448 was doing it wrong and actually did not work. Even its unit testing was testing for a wrong output.
Signed-off-by: gnattu <gnattuoc@me.com>
Hardware encoders has different expectations about quality input. VAAPI's mjpeg encoder excepts JPEG quality divided by QP2LAMBDA as input.
Signed-off-by: gnattu <gnattuoc@me.com>
FFmpeg deletes segments based on its own transcoding progress,
but we need to delete segments based on client download progress.
Since disk and GPU speeds vary, using hlsenc's built-in deletion
will result in premature deletion of some segments. As a consequence,
the server has to constantly respin new ffmpeg instances, resulting
in choppy video playback.
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Similar to https://github.com/jellyfin/jellyfin/pull/10884
---
Jellyfin clients need fonts for subtitles, and each font is a separate
attachment, which causes a lot of re-reads of the file. Certain contents,
like anime in a lot of cases, contain 50-80 different attachments.
Spawning 80 ffmpeg processes at the same time on the same file might
cause swapping on slower HDDs and can bring disk subsystem to a crawl.
(For more info, see https://github.com/jellyfin/jellyfin/3215)
This change helps a lot in this scenario.
Signed-off-by: Attila Szakacs <szakacs.attila96@gmail.com>
Extracting a subtitle stream is a disk I/O bottlenecked operation as
ffmpeg has to read through the whole file, but usually there is nothing
CPU intensive to do.
If a file has multiple subtitle streams, and we want to extract more
of them, extracting them one-by-one results in reading the whole file
again and again.
However ffmpeg can extract multiple streams at once.
We can optimize this by extracting the subtitle streams all at once
when only one of them gets queried, then we will have all of them
cached for later use.
It is useful for people switching subtitles during playback.
It is even more useful for people who extract all the subtitle streams
in advance, for example with the "Subtitle Extract" plugin.
In this case we reduce the extraction time significantly based on the
number of subtitle streams in the files, which can be 5-10 in many
cases.
Signed-off-by: Attila Szakacs <szakacs.attila96@gmail.com>