-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from rohitggarg/master
Adding input seek and duration
- Loading branch information
Showing
4 changed files
with
511 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
package ffmpeg | ||
|
||
import ( | ||
"os/exec" | ||
"bytes" | ||
"strings" | ||
"goffmpeg/utils" | ||
"os/exec" | ||
"bytes" | ||
"strings" | ||
"goffmpeg/utils" | ||
) | ||
|
||
type Configuration struct { | ||
FfmpegBin string | ||
FfprobeBin string | ||
ExecCmd string | ||
ExecArgs string | ||
FfmpegBin string | ||
FfprobeBin string | ||
ExecCmd string | ||
ExecArgs string | ||
} | ||
|
||
func Configure() (Configuration, error) { | ||
var outFFmpeg bytes.Buffer | ||
var outProbe bytes.Buffer | ||
var outFFmpeg bytes.Buffer | ||
var outProbe bytes.Buffer | ||
|
||
execCmd := utils.GetExec() | ||
execFFmpegCommand := utils.GetFFmpegExec() | ||
execFFprobeCommand := utils.GetFFprobeExec() | ||
execArgs := utils.GetExecArgs() | ||
execCmd := utils.GetExec() | ||
execFFmpegCommand := utils.GetFFmpegExec() | ||
execFFprobeCommand := utils.GetFFprobeExec() | ||
execArgs := utils.GetExecArgs() | ||
|
||
cmdFFmpeg := exec.Command(execCmd, execArgs, execFFmpegCommand) | ||
cmdProbe := exec.Command(execCmd, execArgs, execFFprobeCommand) | ||
cmdFFmpeg := exec.Command(execCmd, execArgs, execFFmpegCommand) | ||
cmdProbe := exec.Command(execCmd, execArgs, execFFprobeCommand) | ||
|
||
cmdFFmpeg.Stdout = &outFFmpeg | ||
cmdProbe.Stdout = &outProbe | ||
cmdFFmpeg.Stdout = &outFFmpeg | ||
cmdProbe.Stdout = &outProbe | ||
|
||
err := cmdFFmpeg.Start() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
err := cmdFFmpeg.Start() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
|
||
_, err = cmdFFmpeg.Process.Wait() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
_, err = cmdFFmpeg.Process.Wait() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
|
||
err = cmdProbe.Start() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
err = cmdProbe.Start() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
|
||
_, err = cmdProbe.Process.Wait() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
_, err = cmdProbe.Process.Wait() | ||
if err != nil { | ||
return Configuration{}, err | ||
} | ||
|
||
ffmpeg := strings.Replace(outFFmpeg.String(), "\n", "", -1) | ||
fprobe := strings.Replace(outProbe.String(), "\n", "", -1) | ||
ffmpeg := strings.Replace(outFFmpeg.String(), "\n", "", -1) | ||
fprobe := strings.Replace(outProbe.String(), "\n", "", -1) | ||
|
||
cnf := Configuration{ffmpeg, fprobe, execCmd, execArgs} | ||
cnf := Configuration{ffmpeg, fprobe, execCmd, execArgs} | ||
|
||
return cnf, nil | ||
return cnf, nil | ||
} |
Oops, something went wrong.