Add in-memory caching to /thumbnail endpoint to prevent repeated ffmpeg processing #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Currently, the
/thumbnailendpoint in vthumbs re-processes the same video every time usingffmpeg. Even if the same video URL is requested multiple times, it downloads and processes the video repeatedly. This increases CPU usage and server load unnecessarily.As discussed in Flotilla's Issue #131 and PR #142, we need to add caching to avoid this.
Proposed Solution
videoUrl(query parameter)node-cachepackage (lightweight and simple)Cache-Controlheader for browsers/CDNsAdditional Improvements (Optional)
-qscale:vto reduce memory usage (around 65% quality)Implementation Plan
node-cachedependency/thumbnailroute inindex.jsOnce this is merged, the thumbnail service will be much more efficient, especially for repeated videos.
cc @hodlbod