breaking change: remove default ffmpeg args
This commit is contained in:
@@ -23,21 +23,6 @@ type InputItem struct {
|
||||
ItemType string `json:"-"`
|
||||
}
|
||||
|
||||
type PlayConfig struct {
|
||||
VideoCodec string `json:"video_codec"`
|
||||
Preset string `json:"preset"`
|
||||
CRF int `json:"crf"`
|
||||
MaxRate string `json:"max_rate"`
|
||||
BufSize string `json:"buf_size"`
|
||||
Scale string `json:"scale"`
|
||||
FrameRate int `json:"frame_rate"`
|
||||
AudioCodec string `json:"audio_codec"`
|
||||
AudioBitrate string `json:"audio_bitrate"`
|
||||
AudioSampleRate int `json:"audio_sample_rate"`
|
||||
OutputFormat string `json:"output_format"`
|
||||
CustomArgs []string `json:"custom_args"`
|
||||
}
|
||||
|
||||
type LogConfig struct {
|
||||
PlayState bool `json:"play_state"`
|
||||
}
|
||||
@@ -48,13 +33,13 @@ type ServerConfig struct {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Input []any `json:"input"`
|
||||
InputItems []InputItem `json:"-"` // contains video file or dir
|
||||
VideoList []InputItem `json:"-"` // only contains video file
|
||||
Play PlayConfig `json:"play"`
|
||||
Output OutputConfig `json:"output"`
|
||||
Log LogConfig `json:"log"`
|
||||
Server ServerConfig `json:"server"`
|
||||
Input []any `json:"input"`
|
||||
InputItems []InputItem `json:"-"` // contains video file or dir
|
||||
VideoList []InputItem `json:"-"` // only contains video file
|
||||
Play map[string]any `json:"play"`
|
||||
Output OutputConfig `json:"output"`
|
||||
Log LogConfig `json:"log"`
|
||||
Server ServerConfig `json:"server"`
|
||||
}
|
||||
|
||||
var GlobalConfig Config
|
||||
@@ -103,9 +88,6 @@ func validateConfig() error {
|
||||
if err := validateOutputConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validatePlayConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateServerConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -195,43 +177,6 @@ func validateOutputConfig() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validatePlayConfig() error {
|
||||
if GlobalConfig.Play.VideoCodec == "" {
|
||||
GlobalConfig.Play.VideoCodec = "libx264"
|
||||
}
|
||||
if GlobalConfig.Play.Preset == "" {
|
||||
GlobalConfig.Play.Preset = "fast"
|
||||
}
|
||||
if GlobalConfig.Play.CRF == 0 {
|
||||
GlobalConfig.Play.CRF = 23
|
||||
}
|
||||
if GlobalConfig.Play.MaxRate == "" {
|
||||
GlobalConfig.Play.MaxRate = "8000k"
|
||||
}
|
||||
if GlobalConfig.Play.BufSize == "" {
|
||||
GlobalConfig.Play.BufSize = "12000k"
|
||||
}
|
||||
if GlobalConfig.Play.Scale == "" {
|
||||
GlobalConfig.Play.Scale = "1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2"
|
||||
}
|
||||
if GlobalConfig.Play.FrameRate == 0 {
|
||||
GlobalConfig.Play.FrameRate = 30
|
||||
}
|
||||
if GlobalConfig.Play.AudioCodec == "" {
|
||||
GlobalConfig.Play.AudioCodec = "aac"
|
||||
}
|
||||
if GlobalConfig.Play.AudioBitrate == "" {
|
||||
GlobalConfig.Play.AudioBitrate = "192k"
|
||||
}
|
||||
if GlobalConfig.Play.AudioSampleRate == 0 {
|
||||
GlobalConfig.Play.AudioSampleRate = 48000
|
||||
}
|
||||
if GlobalConfig.Play.OutputFormat == "" {
|
||||
GlobalConfig.Play.OutputFormat = "flv"
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateServerConfig() error {
|
||||
if GlobalConfig.Server.Addr == "" {
|
||||
GlobalConfig.Server.Addr = ":8080"
|
||||
|
||||
Reference in New Issue
Block a user