@@ -38,7 +38,7 @@ func New(cfg *Config) transcoder.Transcoder {
38
38
}
39
39
40
40
// Start ...
41
- func (t * Transcoder ) Start (opts transcoder.Options ) (<- chan transcoder.Progress , * os.Process , error ) {
41
+ func (t * Transcoder ) Start (opts transcoder.Options , mode string ) (<- chan transcoder.Progress , * os.Process , error ) {
42
42
43
43
var stderrIn io.ReadCloser
44
44
@@ -58,7 +58,12 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
58
58
}
59
59
60
60
// Append input file and standard options
61
- args := append ([]string {"-i" , t .input }, opts .GetStrArguments ()... )
61
+ var args []string
62
+ if mode == "gpu" {
63
+ args = append ([]string {"-vsync" , "0" , "-hwaccel" , "cuvid" , "-hwaccel_output_format" , "cuda" , "-i" , t .input }, opts .GetStrArguments ()... )
64
+ } else {
65
+ args = append ([]string {"-i" , t .input }, opts .GetStrArguments ()... )
66
+ }
62
67
outputLength := len (t .output )
63
68
optionsLength := len (t .options )
64
69
@@ -94,6 +99,10 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
94
99
cmd = exec .CommandContext (* t .commandContext , t .config .FfmpegBinPath , args ... )
95
100
}
96
101
102
+ if mode != "" {
103
+ fmt .Printf ("ffmpeg command (%s) is: %s\n " , mode , cmd .String ())
104
+ }
105
+
97
106
// If progresss enabled, get stderr pipe and start progress process
98
107
if t .config .ProgressEnabled && ! t .config .Verbose {
99
108
stderrIn , err = cmd .StderrPipe ()
0 commit comments