Add support for -compression_level and -map_metadata.

This commit is contained in:
Dave Perrett
2019-12-30 23:19:58 +09:00
parent 53b0a69281
commit 54f3bcb504
2 changed files with 44 additions and 0 deletions
+10
View File
@@ -160,6 +160,16 @@ SetHttpMethod
SetHttpKeepAlive
SetOutputPath
SetOutputFormat
SetAudioFilter
SetAudioVariableBitrate
SetCompressionLevel
SetFilter
SetInputInitialOffset
SetInputPipeCommand
SetMapMetadata
SetMetadata
SetStreamIds
SetVideoFilter
```
Example
```golang
+34
View File
@@ -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
}