Skip to content

Commit

Permalink
Merge pull request #6 from rohitggarg/master
Browse files Browse the repository at this point in the history
Output format support while transcoding
  • Loading branch information
xfrr authored May 28, 2018
2 parents 9bdabfb + 20fd427 commit acd7beb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ SetQuality
SetCopyTs
SetInputPath
SetOutputPath
SetOutputFormat
```
Example
```golang
Expand Down
19 changes: 17 additions & 2 deletions models/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Mediafile struct {
seekTimeInput string
inputPath string
outputPath string
outputFormat string
copyTs bool
}

Expand Down Expand Up @@ -145,6 +146,10 @@ func (m *Mediafile) SetOutputPath(val string) {
m.outputPath = val
}

func (m *Mediafile) SetOutputFormat(val string) {
m.outputFormat = val
}

func (m *Mediafile) SetMetadata(v Metadata) {
m.metadata = v
}
Expand Down Expand Up @@ -259,6 +264,10 @@ func (m *Mediafile) OutputPath() string {
return m.outputPath
}

func (m *Mediafile) OutputFormat() string {
return m.outputFormat
}

func (m Mediafile) Metadata() Metadata {
return m.metadata
}
Expand All @@ -267,7 +276,7 @@ func (m Mediafile) Metadata() Metadata {
func (m Mediafile) ToStrCommand() string {
var strCommand string

opts := []string{"SeekTimeInput", "DurationInput", "SeekUsingTsInput", "InputPath", "Aspect", "VideoCodec", "FrameRate", "Resolution", "VideoBitRate", "VideoBitRateTolerance", "AudioCodec", "AudioBitRate", "AudioChannels", "VideoMaxBitRate", "VideoMinBitRate", "BufferSize", "Threads", "Preset", "Target", "Duration", "KeyframeInterval", "SeekTime", "Quality", "MuxDelay", "CopyTs", "OutputPath"}
opts := []string{"SeekTimeInput", "DurationInput", "SeekUsingTsInput", "InputPath", "Aspect", "VideoCodec", "FrameRate", "Resolution", "VideoBitRate", "VideoBitRateTolerance", "AudioCodec", "AudioBitRate", "AudioChannels", "VideoMaxBitRate", "VideoMinBitRate", "BufferSize", "Threads", "Preset", "Target", "Duration", "KeyframeInterval", "SeekTime", "Quality", "MuxDelay", "CopyTs", "OutputFormat", "OutputPath"}
for _, name := range opts {
opt := reflect.ValueOf(&m).MethodByName(fmt.Sprintf("Obtain%s", name))
if (opt != reflect.Value{}) {
Expand Down Expand Up @@ -451,6 +460,13 @@ func (m *Mediafile) ObtainCopyTs() string {
return ""
}

func (m *Mediafile) ObtainOutputFormat() string {
if m.outputFormat != "" {
return fmt.Sprintf("-f %s", m.outputFormat)
}
return ""
}

func (m *Mediafile) ObtainMuxDelay() string {
return fmt.Sprintf("-muxdelay %d", m.muxDelay)
}
Expand All @@ -462,4 +478,3 @@ func (m *Mediafile) ObtainSeekUsingTsInput() string {
return ""
}
}

0 comments on commit acd7beb

Please sign in to comment.