From e8f07968fc5d99787b7ac15f5b792a7be354e790 Mon Sep 17 00:00:00 2001 From: gioelecerati Date: Mon, 5 Aug 2024 18:19:31 +0200 Subject: [PATCH 1/2] uploader: live png thumbnails --- core/uploader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/uploader.go b/core/uploader.go index 8028077..6650e8d 100644 --- a/core/uploader.go +++ b/core/uploader.go @@ -188,7 +188,7 @@ func extractThumb(outputURI *url.URL, segment []byte, storageFallbackURLs map[st return fmt.Errorf("temp file creation failed: %w", err) } defer os.RemoveAll(tmpDir) - outFile := filepath.Join(tmpDir, "out.jpg") + outFile := filepath.Join(tmpDir, "out.png") inFile := filepath.Join(tmpDir, filepath.Base(outputURI.Path)) if err = os.WriteFile(inFile, segment, 0644); err != nil { return fmt.Errorf("failed to write input file: %w", err) @@ -228,7 +228,7 @@ func extractThumb(outputURI *url.URL, segment []byte, storageFallbackURLs map[st } // two thumbs, one at session level, the other at stream level - thumbURLs := []*url.URL{outputURI.JoinPath("../latest.jpg"), outputURI.JoinPath("../../../latest.jpg")} + thumbURLs := []*url.URL{outputURI.JoinPath("../latest.png"), outputURI.JoinPath("../../../latest.png")} fields := &drivers.FileProperties{CacheControl: "max-age=5"} errGroup := &errgroup.Group{} From 4a585ac36b81d39fb10fd8a704e2ac66454df52e Mon Sep 17 00:00:00 2001 From: gioelecerati Date: Mon, 5 Aug 2024 18:20:28 +0200 Subject: [PATCH 2/2] decrease resolution --- core/uploader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/uploader.go b/core/uploader.go index 6650e8d..0bb8e9d 100644 --- a/core/uploader.go +++ b/core/uploader.go @@ -198,7 +198,7 @@ func extractThumb(outputURI *url.URL, segment []byte, storageFallbackURLs map[st "-i", inFile, "-ss", "00:00:00", "-vframes", "1", - "-vf", "scale=854:480:force_original_aspect_ratio=decrease", + "-vf", "scale=640:360:force_original_aspect_ratio=decrease", "-y", outFile, }