18 lines
437 B
Go
18 lines
437 B
Go
package av
|
|
|
|
import (
|
|
"github.com/tidwall/gjson"
|
|
ffmpeg "github.com/u2takey/ffmpeg-go"
|
|
)
|
|
|
|
func GetVideoInfo(filePath string) (int64, int64, int64) {
|
|
probeData, err := ffmpeg.Probe(filePath)
|
|
if err != nil {
|
|
return 0, 0, 0
|
|
}
|
|
duration := gjson.Get(probeData, "format.duration").Int()
|
|
width := gjson.Get(probeData, "streams.0.width").Int()
|
|
height := gjson.Get(probeData, "streams.0.height").Int()
|
|
|
|
return duration, width, height
|
|
}
|