mirror of
https://github.com/xfrr/goffmpeg.git
synced 2025-09-28 04:42:08 +08:00
29 lines
389 B
Go
29 lines
389 B
Go
package transcoder
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os/exec"
|
|
)
|
|
|
|
type Worker struct {
|
|
Command string
|
|
Args string
|
|
Output chan string
|
|
}
|
|
|
|
func (cmd *Worker) Run() {
|
|
out, err := exec.Command(cmd.Command, cmd.Args).Output()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
cmd.Output <- string(out)
|
|
}
|
|
|
|
func Collect(c chan string) {
|
|
for {
|
|
msg := <-c
|
|
fmt.Printf("The command result is %s\n", msg)
|
|
}
|
|
} |