Init
This commit is contained in:
parent
264c97183e
commit
3faede7b1c
74 changed files with 6228 additions and 1 deletions
18
util/av/videoinfo.go
Normal file
18
util/av/videoinfo.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue