mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Add presets support
This commit is contained in:
parent
411e05e998
commit
e3cc80d32a
@ -6,6 +6,9 @@ CACHE_ROOT=/tmp/kyoo_cache
|
||||
LIBRARY_LANGUAGES=en
|
||||
# Hardware transcoding (equivalent of --profile docker compose option).
|
||||
COMPOSE_PROFILES= # vaapi or qsv or nvidia
|
||||
# the preset used during transcode. faster means worst quality, you can probably use a slower preset with hwaccels
|
||||
# warning: using vaapi hwaccel disable presets (they are not supported).
|
||||
GOCODER_PRESET=fast
|
||||
|
||||
# A pattern (regex) to ignore video files.
|
||||
LIBRARY_IGNORE_PATTERN=.*/[dD]ownloads?/.*
|
||||
|
@ -78,7 +78,7 @@ vainfo: Supported profile and entrypoints
|
||||
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP
|
||||
```
|
||||
Kyoo will default to use your primary card (located at `/dev/dri/renderD128`). If you need to specify a secondary one, you
|
||||
can use the `GOTRANSCODER_VAAPI_RENDERER` env-var to specify `/dev/dri/renderD129` or another one.
|
||||
can use the `GOCODER_VAAPI_RENDERER` env-var to specify `/dev/dri/renderD129` or another one.
|
||||
|
||||
Then you can simply run kyoo using `docker compose --profile vaapi up -d` (notice the `--profile vaapi` added)
|
||||
You can also add `COMPOSE_PROFILES=vaapi` to your `.env` instead of adding the `--profile` flag.
|
||||
|
@ -83,7 +83,7 @@ services:
|
||||
devices:
|
||||
- capabilities: [gpu]
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=nvidia
|
||||
- GOCODER_HWACCEL=nvidia
|
||||
profiles: ['nvidia']
|
||||
|
||||
transcoder-vaapi:
|
||||
@ -91,8 +91,8 @@ services:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=vaapi
|
||||
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
- GOCODER_HWACCEL=vaapi
|
||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
profiles: ['vaapi']
|
||||
# qsv is the same setup as vaapi but with the hwaccel env var different
|
||||
transcoder-qsv:
|
||||
@ -100,8 +100,8 @@ services:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=qsv
|
||||
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
- GOCODER_HWACCEL=qsv
|
||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
profiles: ['qsv']
|
||||
|
||||
ingress:
|
||||
|
@ -60,7 +60,7 @@ services:
|
||||
devices:
|
||||
- capabilities: [gpu]
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=nvidia
|
||||
- GOCODER_HWACCEL=nvidia
|
||||
profiles: ['nvidia']
|
||||
|
||||
transcoder-vaapi:
|
||||
@ -68,8 +68,8 @@ services:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=vaapi
|
||||
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
- GOCODER_HWACCEL=vaapi
|
||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
profiles: ['vaapi']
|
||||
# qsv is the same setup as vaapi but with the hwaccel env var different
|
||||
transcoder-qsv:
|
||||
@ -77,8 +77,8 @@ services:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=qsv
|
||||
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
- GOCODER_HWACCEL=qsv
|
||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
profiles: ['qsv']
|
||||
|
||||
ingress:
|
||||
|
@ -59,7 +59,7 @@ services:
|
||||
devices:
|
||||
- capabilities: [gpu]
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=nvidia
|
||||
- GOCODER_HWACCEL=nvidia
|
||||
profiles: ['nvidia']
|
||||
|
||||
transcoder-vaapi:
|
||||
@ -67,8 +67,8 @@ services:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=vaapi
|
||||
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
- GOCODER_HWACCEL=vaapi
|
||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
profiles: ['vaapi']
|
||||
# qsv is the same setup as vaapi but with the hwaccel env var different
|
||||
transcoder-qsv:
|
||||
@ -76,8 +76,8 @@ services:
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
environment:
|
||||
- GOTRANSCODER_HWACCEL=qsv
|
||||
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
- GOCODER_HWACCEL=qsv
|
||||
- GOCODER_VAAPI_RENDERER=${GOCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
|
||||
profiles: ['qsv']
|
||||
|
||||
ingress:
|
||||
|
@ -6,9 +6,17 @@ import (
|
||||
)
|
||||
|
||||
func DetectHardwareAccel() HwAccelT {
|
||||
name := GetEnvOr("GOTRANSCODER_HWACCEL", "disabled")
|
||||
name := GetEnvOr("GOCODER_HWACCEL", "disabled")
|
||||
if name == "disabled" {
|
||||
name = GetEnvOr("GOTRANSCODER_HWACCEL", "disabled")
|
||||
}
|
||||
log.Printf("Using hardware acceleration: %s", name)
|
||||
|
||||
// superfast or ultrafast would produce a file extremly big so we prever to ignore them. Fast is available on all hw accel modes
|
||||
// so we use that by default.
|
||||
// vaapi does not have any presets so this flag is unused for vaapi hwaccel.
|
||||
preset := GetEnvOr("GOCODER_PRESET", "fast")
|
||||
|
||||
switch name {
|
||||
case "disabled":
|
||||
return HwAccelT{
|
||||
@ -16,8 +24,7 @@ func DetectHardwareAccel() HwAccelT {
|
||||
DecodeFlags: []string{},
|
||||
EncodeFlags: []string{
|
||||
"-c:v", "libx264",
|
||||
// superfast or ultrafast would produce a file extremly big so we prever veryfast or faster.
|
||||
"-preset", "fast",
|
||||
"-preset", preset,
|
||||
// sc_threshold is a scene detection mechanisum used to create a keyframe when the scene changes
|
||||
// this is on by default and inserts keyframes where we don't want to (it also breaks force_key_frames)
|
||||
// we disable it to prevents whole scenes from behing removed due to the -f segment failing to find the corresonding keyframe
|
||||
@ -38,7 +45,7 @@ func DetectHardwareAccel() HwAccelT {
|
||||
},
|
||||
EncodeFlags: []string{
|
||||
"-c:v", "h264_nvenc",
|
||||
"-preset", "fast",
|
||||
"-preset", preset,
|
||||
// the exivalent of -sc_threshold on nvidia.
|
||||
"-no-scenecut", "1",
|
||||
},
|
||||
@ -51,7 +58,7 @@ func DetectHardwareAccel() HwAccelT {
|
||||
Name: name,
|
||||
DecodeFlags: []string{
|
||||
"-hwaccel", "vaapi",
|
||||
"-hwaccel_device", GetEnvOr("GOTRANSCODER_VAAPI_RENDERER", "/dev/dri/renderD128"),
|
||||
"-hwaccel_device", GetEnvOr("GOCODER_VAAPI_RENDERER", "/dev/dri/renderD128"),
|
||||
"-hwaccel_output_format", "vaapi",
|
||||
},
|
||||
EncodeFlags: []string{
|
||||
@ -69,12 +76,12 @@ func DetectHardwareAccel() HwAccelT {
|
||||
Name: name,
|
||||
DecodeFlags: []string{
|
||||
"-hwaccel", "qsv",
|
||||
// "-qsv_device", GetEnvOr("GOTRANSCODER_QSV_RENDERER", "/dev/dri/renderD128"),
|
||||
// "-qsv_device", GetEnvOr("GOCODER_QSV_RENDERER", "/dev/dri/renderD128"),
|
||||
"-hwaccel_output_format", "qsv",
|
||||
},
|
||||
EncodeFlags: []string{
|
||||
"-c:v", "h264_qsv",
|
||||
"-preset", "fast",
|
||||
"-preset", preset,
|
||||
},
|
||||
ScaleFilter: "scale_qsv=%d:%d",
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user