mirror of
https://github.com/xfrr/goffmpeg.git
synced 2025-10-05 16:06:50 +08:00

Added getters & setters Get file's metada using ffprobe Getting ffmpeg proccess info: frames processed, bitrate, current time and progress percentage through channel
25 lines
393 B
Go
25 lines
393 B
Go
package utils
|
|
|
|
import (
|
|
"strings"
|
|
"strconv"
|
|
)
|
|
|
|
func DurToSec(dur string) (sec float64) {
|
|
durAry := strings.Split(dur, ":")
|
|
var secs float64
|
|
if len(durAry) != 3 {
|
|
return
|
|
}
|
|
hr, _ := strconv.ParseFloat(durAry[0], 64)
|
|
secs = hr * (60 * 60)
|
|
min, _ := strconv.ParseFloat(durAry[1], 64)
|
|
secs += min * (60)
|
|
second, _ := strconv.ParseFloat(durAry[2], 64)
|
|
secs += second
|
|
return secs
|
|
}
|
|
|
|
|
|
|