feat(media): video versions: still frame + a version every screen plays (platform-v2 5.4e)

- services/video.py: background worker (one video at a time, low priority) makes a still
  frame (thumb/card/full WebP) and, when needed, play.mp4 (H.264+AAC, <=1920 px, HDR
  tone-mapped, faststart); the original is kept. Media.processing/progress (migration 0031,
  existing videos queued). ffmpeg from the pinned imageio-ffmpeg wheel; none = as uploaded.
- MOV (video/quicktime) accepted; /api/media/file/<sha>/play served with ranges.
- Signage plays the version (poster = still frame) and tells the screens playing it when ready.
- Manager library: still frames in the grid, preparing progress, status in the details.
- Tests: test_video.py (8), backend 541 passed; e2e media/signage/stack new checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 02:10:22 +02:00
co-authored by Claude Opus 5.5
parent f8d0d29d8f
commit b5361e10ca
28 changed files with 756 additions and 39 deletions
+1 -1
View File
@@ -129,7 +129,7 @@
},
"media": {
"not_found": "Το αρχείο {{media_id}} δεν υπάρχει στη βιβλιοθήκη πολυμέσων.",
"type": "Ανεβάστε εικόνα (JPG, PNG, WebP, AVIF ή GIF) ή βίντεο (MP4 ή WebM).",
"type": "Ανεβάστε εικόνα (JPG, PNG, WebP, AVIF ή GIF) ή βίντεο (MP4, MOV ή WebM).",
"too_big": "Το αρχείο είναι πολύ μεγάλο (έως {{max_mb}} MB).",
"too_many_pixels": "Η εικόνα είναι πολύ μεγάλη (έως {{max_mp}} megapixel).",
"unreadable": "Αυτή η εικόνα δεν διαβάζεται. Αποθηκεύστε τη ξανά ως JPG ή PNG και ανεβάστε τη.",
+15 -2
View File
@@ -774,11 +774,12 @@
"saveName": "Αποθήκευση ονόματος",
"sizes": "Μεγέθη που φτιάχτηκαν",
"sizesHint": "Ο διακομιστής τα έφτιαξε από το πρωτότυπο· κάθε οθόνη φορτώνει το μικρότερο που χρειάζεται.",
"sizesVideo": "Τα βίντεο κρατιούνται όπως ανέβηκαν προς το παρόν· μικρότερες εκδοχές και στιγμιότυπο έρχονται αργότερα.",
"sizesVideo": "Ο server έφτιαξε ένα στιγμιότυπο από το βίντεο και, όπου χρειάζεται, μια έκδοση που παίζει σε κάθε οθόνη. Το πρωτότυπο κρατιέται.",
"variants": {
"thumb": "Μικρό (λίστες)",
"card": "Κάρτα (μενού)",
"full": "Μεγάλο (πλήρης οθόνη)",
"play": "Για οθόνες (H.264)",
"original": "Πρωτότυπο"
},
"usedBy": "Χρησιμοποιείται από",
@@ -805,7 +806,19 @@
"builtin": "Ενσωματωμένα"
},
"builtin": "Ενσωματωμένο",
"builtinHint": "Οι ενσωματωμένες εικόνες έρχονται με το Xenia: χρησιμοποιούνται παντού, αλλά δεν μετονομάζονται ούτε διαγράφονται."
"builtinHint": "Οι ενσωματωμένες εικόνες έρχονται με το Xenia: χρησιμοποιούνται παντού, αλλά δεν μετονομάζονται ούτε διαγράφονται.",
"processing": {
"waiting": "Περιμένει να ετοιμαστεί για τις οθόνες",
"working": "Ετοιμάζεται για τις οθόνες… {{progress}}%",
"ready": "Έτοιμη έκδοση για κάθε οθόνη",
"asIs": "Παίζει σε κάθε οθόνη όπως είναι",
"failed": "Δεν ετοιμάστηκε: παίζει όπως ανέβηκε, όπου μπορεί η οθόνη"
},
"processingShort": {
"waiting": "Σε αναμονή…",
"working": "Ετοιμάζεται {{progress}}%",
"failed": "Δεν ετοιμάστηκε"
}
},
"signage": {
"pageTitle": "Προβολή",
+1 -1
View File
@@ -129,7 +129,7 @@
},
"media": {
"not_found": "File {{media_id}} isn't in the media library.",
"type": "Upload a picture (JPG, PNG, WebP, AVIF or GIF) or a video (MP4 or WebM).",
"type": "Upload a picture (JPG, PNG, WebP, AVIF or GIF) or a video (MP4, MOV or WebM).",
"too_big": "The file is too big (at most {{max_mb}} MB).",
"too_many_pixels": "The picture is too large (at most {{max_mp}} megapixels).",
"unreadable": "This picture can't be read. Save it again as JPG or PNG and upload it.",
+15 -2
View File
@@ -774,11 +774,12 @@
"saveName": "Save name",
"sizes": "Sizes made",
"sizesHint": "The server made these from the original; each screen loads the smallest one it needs.",
"sizesVideo": "Videos are kept as uploaded for now; smaller versions and a still frame come later.",
"sizesVideo": "The server made a still frame from the video and, where a screen needs it, a version every screen plays. The original is kept.",
"variants": {
"thumb": "Small (lists)",
"card": "Card (menus)",
"full": "Large (full screen)",
"play": "For screens (H.264)",
"original": "Original"
},
"usedBy": "Used by",
@@ -805,7 +806,19 @@
"builtin": "Built-in"
},
"builtin": "Built-in",
"builtinHint": "Built-in pictures come with Xenia: they can be used anywhere, but not renamed or deleted."
"builtinHint": "Built-in pictures come with Xenia: they can be used anywhere, but not renamed or deleted.",
"processing": {
"waiting": "Waiting to be prepared for screens",
"working": "Preparing for screens… {{progress}}%",
"ready": "A version for every screen is ready",
"asIs": "Plays on every screen as it is",
"failed": "Couldn't be prepared: it plays as uploaded where the screen can"
},
"processingShort": {
"waiting": "Waiting…",
"working": "Preparing {{progress}}%",
"failed": "Not prepared"
}
},
"signage": {
"pageTitle": "Signage",
+1 -1
View File
@@ -36,7 +36,7 @@ function VideoSlide({ slide, media, onEnded, playing }) {
}, [m?.src, playing])
return (
<div className="absolute inset-0" style={{ background: c.background_colour || '#000' }}>
{m && <video ref={ref} src={m.src} autoPlay={playing} muted={c.muted !== false || !playing} playsInline loop={!slide.video_to_end}
{m && <video ref={ref} src={m.src} poster={m.poster} autoPlay={playing} muted={c.muted !== false || !playing} playsInline loop={!slide.video_to_end}
onEnded={slide.video_to_end ? onEnded : undefined} onError={slide.video_to_end ? onEnded : undefined}
className="w-full h-full" style={{ objectFit: c.fit || 'cover' }} data-testid="signage-video" />}
</div>
+6 -1
View File
@@ -105,7 +105,12 @@ export function mediaUrls(data) {
if (!data) return []
const lists = data.schedule ? Object.values(data.playlists || {}) : (data.playlist ? [data.playlist] : [])
const out = new Set()
for (const p of lists) for (const m of Object.values(p.media || {})) if (m.url) out.add(m.url)
for (const p of lists) {
for (const m of Object.values(p.media || {})) {
if (m.url) out.add(m.url)
if (m.poster) out.add(m.poster) // a video's still frame (5.4e), shown while it loads
}
}
return [...out]
}
+2
View File
@@ -72,6 +72,8 @@ test('how long a slide stays; the frame for a turned TV; what to keep on the dev
const data = { schedule: {}, playlists: { 1: { media: { 5: { url: '/a' } } }, 2: { media: { 6: { url: '/b' }, 5: { url: '/a' } } } } }
assert.deepEqual(mediaUrls(data).sort(), ['/a', '/b'])
assert.deepEqual(mediaUrls({ playlist: null }), [])
const vid = { playlist: { media: { 7: { url: '/v/play', poster: '/v/full' } } } } // a video keeps its still frame too (5.4e)
assert.deepEqual(mediaUrls(vid).sort(), ['/v/full', '/v/play'])
})
test('a menu board in pages: headings count, a cut group repeats its heading', () => {