- refactors http session usage across modules - adjusts video info extraction - improves temporary directory, concurrency limits, buffering, and error handling in download routines
18 lines
446 B
Go
18 lines
446 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").Float()
|
|
width := gjson.Get(probeData, "streams.0.width").Int()
|
|
height := gjson.Get(probeData, "streams.0.height").Int()
|
|
|
|
return int64(duration), width, height
|
|
}
|