From e07531c396ecba0f1b812783ada17a275d659bf2 Mon Sep 17 00:00:00 2001 From: gioelecerati Date: Thu, 25 Jul 2024 14:40:49 +0200 Subject: [PATCH] thumbnails: png output --- thumbnails/thumbnails.go | 4 +--- thumbnails/thumbnails_test.go | 14 +++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/thumbnails/thumbnails.go b/thumbnails/thumbnails.go index a3c6cd44e..4bcbe4681 100644 --- a/thumbnails/thumbnails.go +++ b/thumbnails/thumbnails.go @@ -219,8 +219,6 @@ func processSegment(input string, thumbOut string) error { "vframes": "1", // video filter to resize "vf": fmt.Sprintf("scale=%s:force_original_aspect_ratio=decrease", resolution), - // set quality - "q:v": "2", }, ).OverWriteOutput().WithErrorOutput(&ffmpegErr).Run() }, clients.DownloadRetryBackoff()) @@ -254,5 +252,5 @@ func thumbFilename(segmentURI string, segmentOffset int64) (string, error) { if err != nil { return "", err } - return fmt.Sprintf("keyframes_%d.jpg", i-segmentOffset), nil + return fmt.Sprintf("keyframes_%d.png", i-segmentOffset), nil } diff --git a/thumbnails/thumbnails_test.go b/thumbnails/thumbnails_test.go index 1fc29d5ad..37080b9df 100644 --- a/thumbnails/thumbnails_test.go +++ b/thumbnails/thumbnails_test.go @@ -104,13 +104,13 @@ func testGenerateThumbsRun(t *testing.T, outDir, input string) { expectedVtt := `WEBVTT 00:00:00.000 --> 00:00:10.000 -keyframes_0.jpg +keyframes_0.png 00:00:10.000 --> 00:00:20.000 -keyframes_1.jpg +keyframes_1.png 00:00:20.000 --> 00:00:30.000 -keyframes_2.jpg +keyframes_2.png ` @@ -118,7 +118,7 @@ keyframes_2.jpg require.NoError(t, err) require.Equal(t, expectedVtt, string(vtt)) - files, err := filepath.Glob(filepath.Join(outDir, "thumbnails", "*.jpg")) + files, err := filepath.Glob(filepath.Join(outDir, "thumbnails", "*.png")) require.NoError(t, err) require.Len(t, files, 3) @@ -143,19 +143,19 @@ func Test_thumbFilename(t *testing.T) { name: "index", segmentURI: "index0.ts", segmentOffset: 0, - want: "keyframes_0.jpg", + want: "keyframes_0.png", }, { name: "clip", segmentURI: "clip_1.ts", segmentOffset: 0, - want: "keyframes_1.jpg", + want: "keyframes_1.png", }, { name: "clip", segmentURI: "clip_101.ts", segmentOffset: 100, - want: "keyframes_1.jpg", + want: "keyframes_1.png", }, } for _, tt := range tests {