This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get width and height resolution string of a video file using FFmpeg | |
// Returns a string like: "1920x1080" | |
func GetVideoResolution(path string) (string, err) { | |
out, err := exec.Command("/usr/bin/ffmpeg", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height", "-of", "csv=s=x:p=0", path).CombinedOutput() | |
if nil != err { | |
return "", err | |
} | |
return strings.TrimSpace(string(out)), nil |