mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-21 09:08:57 +00:00
* Use modified x264 lib * Add x264 system lib * Set x264 version 155 for Debian (Buster) * Add h264 config params * Set vp8 codec
33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
package h264
|
||
|
||
type Options struct {
|
||
// Constant Rate Factor (CRF)
|
||
// This method allows the encoder to attempt to achieve a certain output quality for the whole file
|
||
// when output file size is of less importance.
|
||
// The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible.
|
||
Crf uint8
|
||
// film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency.
|
||
Tune string
|
||
// ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo.
|
||
Preset string
|
||
// baseline, main, high, high10, high422, high444.
|
||
Profile string
|
||
LogLevel int32
|
||
}
|
||
|
||
type Option func(*Options)
|
||
|
||
func WithOptions(arg Options) Option {
|
||
return func(args *Options) {
|
||
args.Crf = arg.Crf
|
||
args.Tune = arg.Tune
|
||
args.Preset = arg.Preset
|
||
args.Profile = arg.Profile
|
||
args.LogLevel = arg.LogLevel
|
||
}
|
||
}
|
||
func Crf(arg uint8) Option { return func(args *Options) { args.Crf = arg } }
|
||
func Tune(arg string) Option { return func(args *Options) { args.Tune = arg } }
|
||
func Preset(arg string) Option { return func(args *Options) { args.Preset = arg } }
|
||
func Profile(arg string) Option { return func(args *Options) { args.Profile = arg } }
|
||
func LogLevel(arg int32) Option { return func(args *Options) { args.LogLevel = arg } }
|