wip: Add quicksync support

This commit is contained in:
Zoe Roux 2024-02-25 02:08:37 +01:00
parent c1cdcddf41
commit 25fc5d5835
5 changed files with 42 additions and 2 deletions

View File

@ -95,6 +95,15 @@ services:
- GOTRANSCODER_HWACCEL=vaapi - GOTRANSCODER_HWACCEL=vaapi
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128} - GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
profiles: ['vaapi'] profiles: ['vaapi']
# qsv is the same setup as vaapi but with the hwaccel env var different
transcoder-qsv:
<<: *transcoder-base
devices:
- /dev/dri:/dev/dri
environment:
- GOTRANSCODER_HWACCEL=qsv
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
profiles: ['qsv']
ingress: ingress:
image: nginx image: nginx

View File

@ -72,6 +72,15 @@ services:
- GOTRANSCODER_HWACCEL=vaapi - GOTRANSCODER_HWACCEL=vaapi
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128} - GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
profiles: ['vaapi'] profiles: ['vaapi']
# qsv is the same setup as vaapi but with the hwaccel env var different
transcoder-qsv:
<<: *transcoder-base
devices:
- /dev/dri:/dev/dri
environment:
- GOTRANSCODER_HWACCEL=qsv
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
profiles: ['qsv']
ingress: ingress:
image: nginx image: nginx

View File

@ -71,6 +71,15 @@ services:
- GOTRANSCODER_HWACCEL=vaapi - GOTRANSCODER_HWACCEL=vaapi
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128} - GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
profiles: ['vaapi'] profiles: ['vaapi']
# qsv is the same setup as vaapi but with the hwaccel env var different
transcoder-qsv:
<<: *transcoder-base
devices:
- /dev/dri:/dev/dri
environment:
- GOTRANSCODER_HWACCEL=qsv
- GOTRANSCODER_VAAPI_RENDERER=${GOTRANSCODER_VAAPI_RENDERER:-/dev/dri/renderD128}
profiles: ['qsv']
ingress: ingress:
image: nginx image: nginx

View File

@ -27,7 +27,7 @@ in
wgo wgo
mediainfo mediainfo
libmediainfo libmediainfo
ffmpeg ffmpeg-full
postgresql_15 postgresql_15
eslint_d eslint_d
prettierd prettierd

View File

@ -17,7 +17,7 @@ func DetectHardwareAccel() HwAccelT {
EncodeFlags: []string{ EncodeFlags: []string{
"-c:v", "libx264", "-c:v", "libx264",
// superfast or ultrafast would produce a file extremly big so we prever veryfast or faster. // superfast or ultrafast would produce a file extremly big so we prever veryfast or faster.
"-preset", "faster", "-preset", "fast",
// sc_threshold is a scene detection mechanisum used to create a keyframe when the scene changes // 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) // 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 // we disable it to prevents whole scenes from behing removed due to the -f segment failing to find the corresonding keyframe
@ -64,6 +64,19 @@ func DetectHardwareAccel() HwAccelT {
}, },
ScaleFilter: "scale_vaapi=%d:%d", ScaleFilter: "scale_vaapi=%d:%d",
} }
case "qsv", "intel":
return HwAccelT{
Name: name,
DecodeFlags: []string{
"-hwaccel", "qsv",
"-hwaccel_output_format", "qsv",
},
EncodeFlags: []string{
"-c:v", "h264_qsv",
"-preset", "fast",
},
ScaleFilter: "scale_qsv=%d:%d",
}
default: default:
log.Printf("No hardware accelerator named: %s", name) log.Printf("No hardware accelerator named: %s", name)
os.Exit(2) os.Exit(2)