From 39763c086835d9b343b1d30da4a71ca6dd429ba9 Mon Sep 17 00:00:00 2001 From: Max Holland Date: Wed, 18 Oct 2023 15:17:35 +0100 Subject: [PATCH] more efficient to just set the timepoint to extract from --- core/uploader.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/uploader.go b/core/uploader.go index 55a681c..7717510 100644 --- a/core/uploader.go +++ b/core/uploader.go @@ -114,15 +114,13 @@ func extractThumb(session drivers.OSSession) { args := []string{ "-i", presigned, - "-vf", "select=eq(pict_type\\,I)", - "-vsync", "vfr", - "-vf", fmt.Sprintf("fps=1/10"), - "-update", "1", + "-ss", "00:00:00", + "-vframes", "1", "-y", outFile, } - timeout, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + timeout, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() cmd := exec.CommandContext(timeout, "ffmpeg", args...) @@ -143,7 +141,7 @@ func extractThumb(session drivers.OSSession) { return } defer f.Close() - _, err = session.SaveData(context.Background(), "../latest.jpg", f, &drivers.FileProperties{CacheControl: "max-age=5"}, 1*time.Minute) + _, err = session.SaveData(context.Background(), "../latest.jpg", f, &drivers.FileProperties{CacheControl: "max-age=5"}, 10*time.Second) if err != nil { log.Printf("Saving thumbnail failed: %s", err) return