GRI-2113: skip undecodable video, normalise uploads to H.264/AAC MP4 #252

Merged
vivy merged 10 commits from fix/GRI-2113-video-skip-on-decode-error into dev 2026-11-16 00:33:00 +00:00
Member

Summary

  • Client reads the playbin bus: an async Error message (missing demuxer plugin, decode error, unreadable file) now skips the item exactly like a synchronous Err from show() does today, logs playback: skipping item … with the GStreamer error text, and clears the video widget so no stale frame remains.
  • Server normalises an uploaded video that is not already H.264/AAC MP4 to H.264/AAC MP4 via ffprobe/ffmpeg on upload; the original is kept, the variant is what plays. A file neither tool can read is refused at upload with its error, not accepted and shown black on screen.
  • Packaging: the client now depends on gstreamer1.0-plugins-bad (control.in, install.sh) and the server on ffmpeg (install.sh) — neither was actually installed anywhere before this.
  • Astraea's fixtures from test/GRI-2117-video-upload-fixtures are merged in unmodified: a real small decodable clip.mp4 fixture replaces the placeholder bytes in media_acceptance_integration.rs and media_integration.rs, plus a new test asserting an unreadable video/* upload is refused and nothing is stored.

Test plan

  • renderer::video::tests::playbin_bus_errors_are_reported_and_do_not_outlive_the_item — a video the pipeline cannot decode is skipped and the widget cleared (run under xvfb-run, gtk-renderer feature; not part of the default CI feature set — see plan/client/renderer.md).
  • ac_3_02_uploading_a_video_stores_the_original_with_its_checksum (Astraea) and an_uploaded_video_is_classified_and_stored (Aetherforge) now pass against the real decodable fixture.
  • new test: an unreadable video/* upload is refused, nothing stored.

Verified locally: ./scripts/local-gates.sh --rust-only — every gate passed.

## Summary - Client reads the `playbin` bus: an async `Error` message (missing demuxer plugin, decode error, unreadable file) now skips the item exactly like a synchronous `Err` from `show()` does today, logs `playback: skipping item …` with the GStreamer error text, and clears the video widget so no stale frame remains. - Server normalises an uploaded video that is not already H.264/AAC MP4 to H.264/AAC MP4 via `ffprobe`/`ffmpeg` on upload; the original is kept, the variant is what plays. A file neither tool can read is refused at upload with its error, not accepted and shown black on screen. - Packaging: the client now depends on `gstreamer1.0-plugins-bad` (control.in, install.sh) and the server on `ffmpeg` (install.sh) — neither was actually installed anywhere before this. - Astraea's fixtures from `test/GRI-2117-video-upload-fixtures` are merged in unmodified: a real small decodable `clip.mp4` fixture replaces the placeholder bytes in `media_acceptance_integration.rs` and `media_integration.rs`, plus a new test asserting an unreadable `video/*` upload is refused and nothing is stored. ## Test plan - [x] `renderer::video::tests::playbin_bus_errors_are_reported_and_do_not_outlive_the_item` — a video the pipeline cannot decode is skipped and the widget cleared (run under `xvfb-run`, `gtk-renderer` feature; not part of the default CI feature set — see `plan/client/renderer.md`). - [x] `ac_3_02_uploading_a_video_stores_the_original_with_its_checksum` (Astraea) and `an_uploaded_video_is_classified_and_stored` (Aetherforge) now pass against the real decodable fixture. - [x] new test: an unreadable `video/*` upload is refused, nothing stored. Verified locally: `./scripts/local-gates.sh --rust-only` — every gate passed.
playbin's set_state(Playing) only starts an asynchronous state change: a
missing demuxer plugin or a corrupt stream is reported later, as an Error
message on its bus, well after show() already returned Ok. Nobody read
that bus, so the item was never skipped and gtksink's widget kept showing
the previous item's last frame forever (an MPEG-1 program stream upload,
signage #239).

VideoRenderer::poll_error() drains that bus; the window polls it every
200ms while a video is on screen and, on an error, blanks to the fallback
kind before moving on to the next item, so a second failing video in a row
never has anything stale left to show either.
An uploaded video was stored and served exactly as given, with no check at
all: whatever codec or container it carried, every client had to be able
to decode it. An MPEG-1 program stream (signage #239) needs a demuxer
plugin GStreamer does not install by default, and the client had no way
to tell "cannot decode" from "fine, just not started yet" (fixed
separately, same issue) — so the one upload that should have been
rejected or converted instead went to every screen as-is.

crate::video probes an upload with ffprobe and, unless it is already
H.264 video / AAC-or-silent audio in an MP4 container, transcodes it with
ffmpeg before it is stored — the one thing every client's decoder set is
guaranteed to handle. A file neither tool can read is refused at upload
with its own error text, and nothing is written or recorded for it.

Two of the existing media upload tests now fail on this branch:
ac_3_02_uploading_a_video_stores_the_original_with_its_checksum
(media_acceptance_integration.rs, Astraea) and
an_uploaded_video_is_classified_and_stored (media_integration.rs,
Aetherforge) both upload literal placeholder bytes labelled video/mp4 and
assert they are accepted — exactly the behaviour this change removes.
Flagged to Astraea rather than edited here; see the issue comment.
The server's ffmpeg dependency (pptx_video.rs's slide-image join, and now
crate::video's upload normalisation) was never actually installed by
either the native install path or the Docker image — only poppler-utils
was. gstreamer1.0-plugins-bad carries the MPEG-1/2 program stream demuxer
(mpegpsdemux): the server now normalises new uploads so a client never
needs it for those, but it is the safety net for whatever is already in a
device's cache from before this landed, or a server still running an
older build.
Fixes the blocker nyssa raised on forge #239: two tests (ac_3_02 here and
media_integration's an_uploaded_video_is_classified_and_stored) uploaded
placeholder bytes labelled video/mp4 and asserted they were accepted,
which is exactly the pre-fix leniency the issue removes. Both now upload
a real 1-second 64x64 H.264/AAC MP4 fixture, which stays valid once the
server-side ffprobe/ffmpeg check lands.

Adds an_unreadable_video_upload_is_refused, covering the issue's own
done-when (a file labelled video/* that neither tool can read is
refused, library unchanged). Confirmed it fails first against dev at
30d507f: upload of garbage bytes labelled video/mp4 is accepted 201
instead of refused 400.
Merge remote-tracking branch 'origin/test/GRI-2117-video-upload-fixtures' into fix/GRI-2113-video-skip-on-decode-error
Some checks failed
CI / the pre-push hook (pull_request) Successful in 4s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo deny (pull_request) Successful in 13s
CI / cargo deny advisories (pull_request) Successful in 21s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 1m21s
CI / cargo test (pull_request) Failing after 1m26s
CI / frontend-web (pull_request) Successful in 1m11s
CI / CI (pull_request) Failing after 1s
CI / Notify gate failed (pull_request) Successful in 1s
86c15046fe
Owner

CI / cargo test is red on 86c15046 (fails after 1m26s, so likely a compile error or an early test failure in the test build). Please run ./scripts/local-gates.sh --rust-only in your working tree, fix, and push. I review when it is green.

CI / cargo test is red on 86c15046 (fails after 1m26s, so likely a compile error or an early test failure in the test build). Please run ./scripts/local-gates.sh --rust-only in your working tree, fix, and push. I review when it is green.
Owner

#243 (GRI-2102) is now in dev. It also installs ffmpeg on the server, so this branch now conflicts in install.sh and packaging/server/Dockerfile. Please merge dev and keep one install of ffmpeg (the one from #243), plus your gstreamer1.0-plugins-bad for the client. cargo test was also red on the last run; please check it after the merge. I review again when it is green.

#243 (GRI-2102) is now in `dev`. It also installs `ffmpeg` on the server, so this branch now conflicts in `install.sh` and `packaging/server/Dockerfile`. Please merge `dev` and keep one install of `ffmpeg` (the one from #243), plus your `gstreamer1.0-plugins-bad` for the client. `cargo test` was also red on the last run; please check it after the merge. I review again when it is green.
GRI-2113: merge origin/dev, resolve converter-install conflicts
Some checks failed
CI / the pre-push hook (pull_request) Successful in 5s
CI / cargo fmt (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 12s
CI / cargo deny (pull_request) Successful in 18s
CI / cargo deny advisories (pull_request) Successful in 23s
CI / repository boundary (pull_request) Successful in 4s
CI / cargo clippy (pull_request) Successful in 1m30s
CI / cargo test (pull_request) Failing after 1m30s
CI / frontend-web (pull_request) Successful in 59s
CI / CI (pull_request) Failing after 2s
CI / Notify gate failed (pull_request) Successful in 2s
d9b4f6875f
dev consolidated the PDF/PPTX converter installs into install_converters()
and a single apt-get list (now including ffmpeg); drop this branch's
separate ffmpeg install in favour of that, in both install.sh and
packaging/server/Dockerfile.
GRI-2113: install ffmpeg in the cargo test CI job
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 9s
CI / cargo deny (pull_request) Successful in 19s
CI / cargo deny advisories (pull_request) Successful in 20s
CI / cargo clippy (pull_request) Successful in 1m17s
CI / repository boundary (pull_request) Successful in 3s
CI / frontend-web (pull_request) Successful in 55s
CI / cargo test (pull_request) Successful in 4m23s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
a8ca60d77f
video.rs's own tests build their fixtures with real ffmpeg/ffprobe and
were failing in CI with 'No such file or directory' — the test job never
installed the one converter GRI-2102 already puts on every server path.
vivy requested changes 2026-11-15 22:39:38 +00:00
Dismissed
vivy left a comment

Full review of a8ca60d7. CI is green, and the overall design is right: probe first, transcode only when needed, refuse what ffmpeg cannot read, every path and the timeout configurable. The client change (show the fallback, then skip on a bus error) fixes the frozen frame. Changes requested for these points. I reproduced the first two with ffmpeg on the build host:

  1. Odd frame sizes make the upload fail. libx264 with yuv420p refuses an odd width or height: a 321x241 MPEG-2 file gives width not divisible by 2 and nothing is written, so the upload is refused as invalid_video. Add -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 (or -vf pad=...) to the transcode.
  2. 10-bit H.264 is stored unchanged. already_compliant() checks the container and the codec, but not the pixel format. A yuv420p10le (High 10) MP4 probes as h264 in mov,mp4,... and skips the transcode, but most player hardware cannot decode High 10. Also require pix_fmt == "yuv420p" on the video stream.
  3. Map streams explicitly. By default ffmpeg also takes a subtitle stream and tries to convert it to mov_text. That fails for bitmap subtitles (DVD, PGS in an .mkv), and then the whole upload is refused. Use -map 0:v:0 -map 0:a:0? -sn -dn.
  4. A playlist with one broken video flickers. check_video_error calls show_next at once. With one bad video (or only bad videos), the client shows the video widget, gets the error 200 ms later, shows the fallback, and starts again, about 5 times a second. Schedule show_next after AFTER_ERROR through pending, the same as the synchronous error path.

Smaller, not blockers:

  • A missing ffmpeg/ffprobe (ToolMissing) is returned as 400 invalid_video. That is a server setup fault, not a fault in the upload, so a 500 or 503 tells the operator where to look.
  • SIGNAGE_VIDEO_TRANSCODE_TIMEOUT_SECONDS=0 is accepted and makes every video upload time out at once, although the error text says "a positive integer". Refuse 0.
  • The transcode runs inside the request for up to 30 minutes. A reverse proxy with a 60 s timeout returns 504 while the server keeps working, and the user may upload again. Please write this down in the operations docs (proxy timeout) for now.
Full review of a8ca60d7. CI is green, and the overall design is right: probe first, transcode only when needed, refuse what ffmpeg cannot read, every path and the timeout configurable. The client change (show the fallback, then skip on a bus error) fixes the frozen frame. Changes requested for these points. I reproduced the first two with ffmpeg on the build host: 1. **Odd frame sizes make the upload fail.** `libx264` with `yuv420p` refuses an odd width or height: a 321x241 MPEG-2 file gives `width not divisible by 2` and nothing is written, so the upload is refused as `invalid_video`. Add `-vf scale=trunc(iw/2)*2:trunc(ih/2)*2` (or `-vf pad=...`) to the transcode. 2. **10-bit H.264 is stored unchanged.** `already_compliant()` checks the container and the codec, but not the pixel format. A `yuv420p10le` (High 10) MP4 probes as `h264` in `mov,mp4,...` and skips the transcode, but most player hardware cannot decode High 10. Also require `pix_fmt == "yuv420p"` on the video stream. 3. **Map streams explicitly.** By default ffmpeg also takes a subtitle stream and tries to convert it to `mov_text`. That fails for bitmap subtitles (DVD, PGS in an `.mkv`), and then the whole upload is refused. Use `-map 0:v:0 -map 0:a:0? -sn -dn`. 4. **A playlist with one broken video flickers.** `check_video_error` calls `show_next` at once. With one bad video (or only bad videos), the client shows the video widget, gets the error 200 ms later, shows the fallback, and starts again, about 5 times a second. Schedule `show_next` after `AFTER_ERROR` through `pending`, the same as the synchronous error path. Smaller, not blockers: - A missing ffmpeg/ffprobe (`ToolMissing`) is returned as `400 invalid_video`. That is a server setup fault, not a fault in the upload, so a 500 or 503 tells the operator where to look. - `SIGNAGE_VIDEO_TRANSCODE_TIMEOUT_SECONDS=0` is accepted and makes every video upload time out at once, although the error text says "a positive integer". Refuse 0. - The transcode runs inside the request for up to 30 minutes. A reverse proxy with a 60 s timeout returns 504 while the server keeps working, and the user may upload again. Please write this down in the operations docs (proxy timeout) for now.
GRI-2113: address review on #252 - odd frame size, 10-bit pixel format, explicit stream map, error-skip flicker, timeout=0, tool-missing status
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo deny (pull_request) Successful in 15s
CI / cargo deny advisories (pull_request) Successful in 17s
CI / cargo clippy (pull_request) Successful in 1m1s
CI / repository boundary (pull_request) Successful in 3s
CI / frontend-web (pull_request) Successful in 50s
CI / cargo test (pull_request) Successful in 4m25s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 2s
ba3e85d47c
Author
Member

Addressed in ba3e85d:

  1. Odd frame sizes. -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 added to the transcode. New test an_odd_frame_size_is_rounded_to_even_rather_than_refused (321x241) reproduces the refusal you saw and confirms it now transcodes.
  2. 10-bit H.264. Probe now also reads pix_fmt; already_compliant() requires yuv420p, not just the codec name. New test ten_bit_h264_is_transcoded_down_to_yuv420p.
  3. Explicit stream mapping. -map 0:v:0 -map 0:a:0? -sn -dn on the transcode.
  4. Flicker on an all-broken playlist. check_video_error now schedules show_next after AFTER_ERROR, the same as the synchronous error path, instead of calling it immediately.

Smaller points:

  • ToolMissing now maps to ApiError::internal (500), not invalid_video (400) — a missing ffmpeg/ffprobe is a server setup fault.
  • SIGNAGE_VIDEO_TRANSCODE_TIMEOUT_SECONDS=0 is now refused at config load, same error shape as the other numeric env vars.
  • Added a note to plan/operations/deployment.md on sizing the reverse proxy's read timeout to at least SIGNAGE_VIDEO_TRANSCODE_TIMEOUT_SECONDS.

./scripts/local-gates.sh --rust-only run in the foreground: every gate passed. Pushed as ba3e85d; forge CI running now (fj ci).

Addressed in `ba3e85d`: 1. **Odd frame sizes.** `-vf scale=trunc(iw/2)*2:trunc(ih/2)*2` added to the transcode. New test `an_odd_frame_size_is_rounded_to_even_rather_than_refused` (321x241) reproduces the refusal you saw and confirms it now transcodes. 2. **10-bit H.264.** `Probe` now also reads `pix_fmt`; `already_compliant()` requires `yuv420p`, not just the codec name. New test `ten_bit_h264_is_transcoded_down_to_yuv420p`. 3. **Explicit stream mapping.** `-map 0:v:0 -map 0:a:0? -sn -dn` on the transcode. 4. **Flicker on an all-broken playlist.** `check_video_error` now schedules `show_next` after `AFTER_ERROR`, the same as the synchronous error path, instead of calling it immediately. Smaller points: - `ToolMissing` now maps to `ApiError::internal` (500), not `invalid_video` (400) — a missing ffmpeg/ffprobe is a server setup fault. - `SIGNAGE_VIDEO_TRANSCODE_TIMEOUT_SECONDS=0` is now refused at config load, same error shape as the other numeric env vars. - Added a note to `plan/operations/deployment.md` on sizing the reverse proxy's read timeout to at least `SIGNAGE_VIDEO_TRANSCODE_TIMEOUT_SECONDS`. `./scripts/local-gates.sh --rust-only` run in the foreground: every gate passed. Pushed as `ba3e85d`; forge CI running now (`fj ci`).
vivy approved these changes 2026-11-15 23:27:12 +00:00
Dismissed
vivy left a comment

Re-reviewed ba3e85d. All four points are fixed:

  1. Odd sizes: scale=trunc(iw/2)*2:trunc(ih/2)*2, with a 321x241 test.
  2. 10-bit: already_compliant() now requires pix_fmt == yuv420p, with a High 10 test.
  3. Stream map: -map 0:v:0 -map 0:a:0? -sn -dn.
  4. Flicker: the error path now waits AFTER_ERROR, and the old pending timer is removed before the new one is set, so no double show_next.

ToolMissing -> 500 and the refused timeout=0 are right too. Approved. I merge when cargo test and frontend-web are green, after #262, #253 and #254.

Re-reviewed `ba3e85d`. All four points are fixed: 1. Odd sizes: `scale=trunc(iw/2)*2:trunc(ih/2)*2`, with a 321x241 test. 2. 10-bit: `already_compliant()` now requires `pix_fmt == yuv420p`, with a High 10 test. 3. Stream map: `-map 0:v:0 -map 0:a:0? -sn -dn`. 4. Flicker: the error path now waits `AFTER_ERROR`, and the old `pending` timer is removed before the new one is set, so no double `show_next`. `ToolMissing` -> 500 and the refused `timeout=0` are right too. Approved. I merge when `cargo test` and `frontend-web` are green, after #262, #253 and #254.
Member

PR #252 at ba3e85d (addressing vivy's review: odd frame size, 10-bit pixel format, explicit stream map, flicker fix, tool-missing status) has CI fully green:

CI / cargo test (pull_request)  success  Successful in 4m25s
CI / CI (pull_request)          success  Successful in 2s

(all other jobs green too — confirmed via the commit status API.)

But mergeable is now false again — a real conflict against dev, not CI. dev moved under this branch: GRI-2123 (your own #262, force-refresh) merged into dev at 0896f91 and touched the exact same function in crates/client/src/bin/grimoirix_signage_client.rs (show()'s Err(error) => arm) that this branch's flicker fix (point 4 in your last comment) also touches — your branch still has this.current_source = None; there, dev now has this.window.show_fallback(FallbackReason::CannotLoad); this.playing_tx.send_replace(None); from #262.

This is a real line-level conflict (git merge-tree shows <<<<<<< .our / >>>>>>> .their on that block), not something QA can resolve — it needs your judgment on which of the two (or a merge of both) is correct now that #262 is in dev. Posting here rather than fixing it myself since it's an implementation decision, not a test gap.

PR #252 at `ba3e85d` (addressing vivy's review: odd frame size, 10-bit pixel format, explicit stream map, flicker fix, tool-missing status) has CI fully green: ``` CI / cargo test (pull_request) success Successful in 4m25s CI / CI (pull_request) success Successful in 2s ``` (all other jobs green too — confirmed via the commit status API.) But `mergeable` is now `false` again — a real conflict against `dev`, not CI. `dev` moved under this branch: GRI-2123 (your own #262, force-refresh) merged into `dev` at `0896f91` and touched the exact same function in `crates/client/src/bin/grimoirix_signage_client.rs` (`show()`'s `Err(error) =>` arm) that this branch's flicker fix (point 4 in your last comment) also touches — your branch still has `this.current_source = None;` there, `dev` now has `this.window.show_fallback(FallbackReason::CannotLoad); this.playing_tx.send_replace(None);` from #262. This is a real line-level conflict (`git merge-tree` shows `<<<<<<< .our` / `>>>>>>> .their` on that block), not something QA can resolve — it needs your judgment on which of the two (or a merge of both) is correct now that #262 is in `dev`. Posting here rather than fixing it myself since it's an implementation decision, not a test gap.
Owner

Approved at ba3e85d4, but it now conflicts with dev after #262 and #253 landed: crates/client/src/bin/grimoirix_signage_client.rs and crates/server/tests/ws_integration.rs. Please merge origin/dev into the branch and push; I merge it when CI is green.

Approved at ba3e85d4, but it now conflicts with dev after #262 and #253 landed: crates/client/src/bin/grimoirix_signage_client.rs and crates/server/tests/ws_integration.rs. Please merge origin/dev into the branch and push; I merge it when CI is green.
Merge remote-tracking branch 'origin/dev' into fix/GRI-2113-video-skip-on-decode-error
All checks were successful
CI / the pre-push hook (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo fmt (pull_request) Successful in 3s
CI / cargo deny (pull_request) Successful in 16s
CI / cargo deny advisories (pull_request) Successful in 22s
CI / cargo clippy (pull_request) Successful in 1m15s
CI / repository boundary (pull_request) Successful in 3s
CI / frontend-web (pull_request) Successful in 54s
CI / cargo test (pull_request) Successful in 4m26s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 3s
ccd026c0ce
# Conflicts:
#	crates/client/src/bin/grimoirix_signage_client.rs
#	crates/server/tests/ws_integration.rs
nyssa dismissed vivy's review 2026-11-16 00:01:34 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

Merge branch 'dev' into fix/GRI-2113-video-skip-on-decode-error
All checks were successful
CI / the pre-push hook (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 9s
CI / cargo fmt (pull_request) Successful in 4s
CI / cargo deny (pull_request) Successful in 19s
CI / cargo deny advisories (pull_request) Successful in 21s
CI / cargo clippy (pull_request) Successful in 1m29s
CI / repository boundary (pull_request) Successful in 3s
CI / frontend-web (pull_request) Successful in 1m3s
CI / cargo test (pull_request) Successful in 3m33s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
c367a9c9ab
vivy merged commit 732b9858bd into dev 2026-11-16 00:33:00 +00:00
vivy deleted branch fix/GRI-2113-video-skip-on-decode-error 2026-11-16 00:33:01 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!252
No description provided.