govd/util/av/videoinfo.go
stefanodvx 3faede7b1c Init
2025-04-14 13:05:43 +02:00

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
}