From d3a1c5711196e18f1c21f19d70bcc90400530a32 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 13 Jan 2024 19:04:43 +0100 Subject: [PATCH] Add ffprobe duration in print --- transcoder/src/filestream.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transcoder/src/filestream.go b/transcoder/src/filestream.go index 47e3af33..88872613 100644 --- a/transcoder/src/filestream.go +++ b/transcoder/src/filestream.go @@ -7,6 +7,7 @@ import ( "os/exec" "strconv" "strings" + "time" ) type FileStream struct { @@ -51,6 +52,7 @@ func NewFileStream(path string) (*FileStream, error) { func GetKeyframes(path string) ([]float64, bool, error) { // run ffprobe to return all IFrames, IFrames are points where we can split the video in segments. log.Printf("Starting ffprobe for keyframes analysis for %s", path) + start := time.Now() out, err := exec.Command( "ffprobe", "-loglevel", "error", @@ -59,7 +61,7 @@ func GetKeyframes(path string) ([]float64, bool, error) { "-of", "csv=print_section=0", path, ).Output() - log.Printf("%s ffprobe analysis finished", path) + log.Printf("%s ffprobe analysis finished in %s", path, time.Since(start)) // We ask ffprobe to return the time of each frame and it's flags // We could ask it to return only i-frames (keyframes) with the -skip_frame nokey but using it is extremly slow // since ffmpeg parses every frames when this flag is set.