Skip to content

Commit

Permalink
more efficient to just set the timepoint to extract from
Browse files Browse the repository at this point in the history
  • Loading branch information
mjh1 committed Oct 19, 2023
1 parent 5c3028d commit 39763c0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)

Expand All @@ -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
Expand Down

0 comments on commit 39763c0

Please sign in to comment.