Add screenshot API endpoint with video frame capture#2668
Open
Alex1981-tech wants to merge 2 commits intoScreenly:masterfrom
Open
Add screenshot API endpoint with video frame capture#2668Alex1981-tech wants to merge 2 commits intoScreenly:masterfrom
Alex1981-tech wants to merge 2 commits intoScreenly:masterfrom
Conversation
Add GET /api/v2/screenshot endpoint that captures what is currently displayed on the screen. For video assets, VLC on Raspberry Pi uses a hardware overlay that bypasses the Linux framebuffer, resulting in black screenshots. This endpoint detects video playback via viewlog.db and extracts the current frame using ffmpeg. For images and web pages, it falls back to reading /dev/fb0. Features: - Auto-detect video playback from viewlog.db - Extract video frame via ffmpeg at current elapsed time - Framebuffer capture (/dev/fb0) fallback for non-video content - 5-second response cache to prevent excessive captures - Returns JPEG image (640px width, quality 60) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
@Alex1981-tech, thank you for opening a pull request. I will test the changes when I get the chance. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
CI fix update:
This PR changes only |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Add
GET /api/v2/screenshotendpoint that captures what is currently displayed on the screen.Problem
On Raspberry Pi 4, VLC uses a hardware video overlay that bypasses the Linux framebuffer (
/dev/fb0). This means the existing framebuffer-based screenshot approach returns a black image whenever a video asset is playing.Solution
The new
ScreenshotViewV2endpoint:viewlog.dbfor the currently playing asset (written by the viewer on every asset start)ffmpeg -ss <elapsed> -i <file> -frames:v 1(scaled to 640px width, JPEG quality 60, ~15KB output)/dev/fb0) as beforeAPI
Dependencies
ffmpeg(already available in the server container)viewlog.dbin/data/.screenly/(shared between viewer and server containers via bind mount)Testing
Tested on Raspberry Pi 4 Model B (8GB) with: