mirror of
https://github.com/xfrr/goffmpeg.git
synced 2026-04-22 23:17:21 +08:00
Add support for -compression_level and -map_metadata.
This commit is contained in:
@@ -160,6 +160,16 @@ SetHttpMethod
|
||||
SetHttpKeepAlive
|
||||
SetOutputPath
|
||||
SetOutputFormat
|
||||
SetAudioFilter
|
||||
SetAudioVariableBitrate
|
||||
SetCompressionLevel
|
||||
SetFilter
|
||||
SetInputInitialOffset
|
||||
SetInputPipeCommand
|
||||
SetMapMetadata
|
||||
SetMetadata
|
||||
SetStreamIds
|
||||
SetVideoFilter
|
||||
```
|
||||
Example
|
||||
```golang
|
||||
|
||||
@@ -61,6 +61,8 @@ type Mediafile struct {
|
||||
audioFilter string
|
||||
skipVideo bool
|
||||
skipAudio bool
|
||||
compressionLevel int
|
||||
mapMetadata string
|
||||
}
|
||||
|
||||
/*** SETTERS ***/
|
||||
@@ -273,6 +275,14 @@ func (m *Mediafile) SetMetadata(v Metadata) {
|
||||
m.metadata = v
|
||||
}
|
||||
|
||||
func (m *Mediafile) SetCompressionLevel(val int) {
|
||||
m.compressionLevel = val
|
||||
}
|
||||
|
||||
func (m *Mediafile) SetMapMetadata(val string) {
|
||||
m.mapMetadata = val
|
||||
}
|
||||
|
||||
/*** GETTERS ***/
|
||||
|
||||
// Deprecated: Use VideoFilter instead.
|
||||
@@ -484,6 +494,14 @@ func (m *Mediafile) Metadata() Metadata {
|
||||
return m.metadata
|
||||
}
|
||||
|
||||
func (m *Mediafile) CompressionLevel() int {
|
||||
return m.compressionLevel
|
||||
}
|
||||
|
||||
func (m *Mediafile) MapMetadata() string {
|
||||
return m.mapMetadata
|
||||
}
|
||||
|
||||
/** OPTS **/
|
||||
func (m *Mediafile) ToStrCommand() []string {
|
||||
var strCommand []string
|
||||
@@ -537,6 +555,8 @@ func (m *Mediafile) ToStrCommand() []string {
|
||||
"VideoFilter",
|
||||
"HttpMethod",
|
||||
"HttpKeepAlive",
|
||||
"CompressionLevel",
|
||||
"MapMetadata",
|
||||
"OutputPath",
|
||||
}
|
||||
for _, name := range opts {
|
||||
@@ -910,3 +930,17 @@ func (m *Mediafile) ObtainStreamIds() []string {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mediafile) ObtainCompressionLevel() []string {
|
||||
if m.compressionLevel != 0 {
|
||||
return []string{"-compression_level", fmt.Sprintf("%d", m.compressionLevel)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mediafile) ObtainMapMetadata() []string {
|
||||
if m.mapMetadata != "" {
|
||||
return []string{"-map_metadata", m.mapMetadata}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user