feat: initial CLI converter (v1.2)
This commit is contained in:
commit
02fd1dc817
5 files changed
+284
No files matched your search
+36
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
type ffprobeOutput struct {
|
||||
Streams []struct {
|
||||
CodecType string `json:"codec_type"`
|
||||
} `json:"streams"`
|
||||
}
|
||||
|
||||
func ffprobe(inputFile string) (*ffprobeOutput, error) {
|
||||
var err error
|
||||
var out ffprobeOutput
|
||||
|
||||
args := []string{
|
||||
"-v", "quiet",
|
||||
"-print_format", "json",
|
||||
"-show_streams",
|
||||
inputFile,
|
||||
}
|
||||
proc := exec.Command("ffprobe", args...)
|
||||
stdout, err := proc.Output()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// fmt.Println("read", string(stdout))
|
||||
|
||||
err = json.Unmarshal(stdout, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
Reference in new issue
Block a user