realxlfd
3 months ago
1 changed files with 32 additions and 0 deletions
@ -0,0 +1,32 @@ |
|||
package ffmpeg |
|||
|
|||
import ( |
|||
"errors" |
|||
"os" |
|||
"os/exec" |
|||
"path/filepath" |
|||
) |
|||
|
|||
func Check(file string) error { |
|||
stat, err := os.Stat(file) |
|||
if err != nil || stat.IsDir() { |
|||
return errors.New("file not found") |
|||
} |
|||
appPath := filepath.Join( |
|||
ffmpegPath, |
|||
`ffmpeg`, |
|||
) |
|||
// ffmpeg -v error -i your_video_file.mp4 -f null -
|
|||
cmd := exec.Command( |
|||
appPath, |
|||
`-v`, |
|||
`error`, |
|||
`-i`, |
|||
file, |
|||
`-f`, |
|||
`null`, |
|||
`-`, |
|||
) |
|||
err = cmd.Run() |
|||
return err |
|||
} |
Loading…
Reference in new issue