Rearchitected transcoding to treat codecs and encoders as separate concepts.
ActivityPub Tests / federation-test (push) Failing after 4s
ActivityPub Tests / chat-sanitization-test (push) Failing after 3s
ActivityPub Tests / follower-validation-test (push) Failing after 4s
Extract Default Translations / extract-and-commit (push) Successful in 4m21s
Automated API tests / test (push) Has been cancelled
Browser Tests / cypress-run (push) Has been cancelled
Chromatic / chromatic-deployment (push) Has been cancelled
CSS Lint and Formatting / css-lint (push) Has been cancelled
javascript-packages / Generate API Documentation (push) Has been cancelled
Lint / Go linter (push) Has been cancelled
Go Tests / test (push) Has been cancelled
Go Tests / test-bsds (map[name:freebsd version:12.2]) (push) Has been cancelled
Go Tests / test-bsds (map[name:openbsd version:6.8]) (push) Has been cancelled
HLS tests / tests (push) Has been cancelled
ActivityPub Tests / federation-test (push) Failing after 4s
ActivityPub Tests / chat-sanitization-test (push) Failing after 3s
ActivityPub Tests / follower-validation-test (push) Failing after 4s
Extract Default Translations / extract-and-commit (push) Successful in 4m21s
Automated API tests / test (push) Has been cancelled
Browser Tests / cypress-run (push) Has been cancelled
Chromatic / chromatic-deployment (push) Has been cancelled
CSS Lint and Formatting / css-lint (push) Has been cancelled
javascript-packages / Generate API Documentation (push) Has been cancelled
Lint / Go linter (push) Has been cancelled
Go Tests / test (push) Has been cancelled
Go Tests / test-bsds (map[name:freebsd version:12.2]) (push) Has been cancelled
Go Tests / test-bsds (map[name:openbsd version:6.8]) (push) Has been cancelled
HLS tests / tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package transcoder
|
||||
|
||||
import log "github.com/sirupsen/logrus"
|
||||
|
||||
// QuicksyncEncoder uses Intel Quick Sync Video hardware encoding.
|
||||
type QuicksyncEncoder struct{}
|
||||
|
||||
func (e *QuicksyncEncoder) Name() string {
|
||||
return "qsv"
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) DisplayName() string {
|
||||
return "Intel QuickSync"
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) GlobalFlags() []string {
|
||||
return []string{
|
||||
"-init_hw_device", "qsv=hw",
|
||||
"-filter_hw_device", "hw",
|
||||
}
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) PixelFormat() string {
|
||||
return "qsv"
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) Scaler() string {
|
||||
return "scale_qsv"
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) ExtraFilters() string {
|
||||
return "hwupload=extra_hw_frames=64,format=qsv"
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) ExtraArguments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) VariantFlags(v *HLSVariant) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) SupportedVideoCodecs() []string {
|
||||
return []string{videoCodecH264}
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) FFmpegEncoderForCodec(codec string) string {
|
||||
switch codec {
|
||||
case videoCodecH264:
|
||||
return "h264_qsv"
|
||||
default:
|
||||
log.Warnf("quicksync encoder does not support codec %q, falling back to h264_qsv", codec)
|
||||
return "h264_qsv"
|
||||
}
|
||||
}
|
||||
|
||||
func (e *QuicksyncEncoder) GetPresetForLevel(l int) string {
|
||||
presetMapping := map[int]string{
|
||||
0: "veryfast",
|
||||
1: "fast",
|
||||
2: "medium",
|
||||
3: "slow",
|
||||
4: "veryslow",
|
||||
}
|
||||
preset, ok := presetMapping[l]
|
||||
if !ok {
|
||||
defaultPreset := presetMapping[2]
|
||||
log.Errorf("Invalid level for quicksync preset %d, defaulting to %s", l, defaultPreset)
|
||||
return defaultPreset
|
||||
}
|
||||
return preset
|
||||
}
|
||||
Reference in New Issue
Block a user