Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display video errors & video blob information #7433

Merged
merged 20 commits into from
Sep 19, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Sep 17, 2024

What

  • Fixes Warn on unsupported video #7373
    • I'm sure there's more to do here and surely more cases to try out whether they display the correct errors, but this PR should handle everything that we detect as an error case, laying the foundation to pass everything through

As part of this work it was necessary to make clearer difference between video loading and video decoding. You'll notice changes in re_renderer's video and the video cache accordingly.
(there's some loose ends here like "don't create a decoder when we're just inspecting a blob" which will be part of #7420)

Generally, decode errors can only occur when showing (!) a video frame, therefore they are shown on screen as part of a the 2D/3D view:
image
(trying to show frames on native)

Note that you can interact with this 2D view just as if error was logged data:

video.error.interaction.mp4

On the other hand when we can't read the blob itself (potentially without trying to decode it) the errors show up on it like this:
image

Since this error happens already on loading right now we can't generate frames automatically if you drag&drop in a video like this. But you can still log your frames manually, resulting in this:
image
In the shown example the blob isn't part of the entity since we're referring to a different entity for the blob. Also, this is actually a native screenshot - the avc parsing error comes before decoding, which is why this comes up prior to the lack of decoder.
If we instead have the failing blob on the entity that also has the frame, we get this view:
image

When there's no error, we show now a little bit of information for blobs:
image
(blob selected)
image
(data result with this blob selected)

Some shortcomings:

  • some decode errors like "we can't decode this at all because it's not supported", could be shown was warnings the property grid on blobs. This is quite unfavorable from a program structure perspective, but as user I'd be wondering why not?
  • dragging in a video format with an unknown codec won't generate frames and therefore no big "can't read this video" which is rather unfortunate. As we progress in separating video container reading & decoding this is going to get better!
  • blob errors aren't terribly well formatted / a bit ugly
  • error states in streams panel as suggested on the ticket would be nice, but that's a more general rabbit hole feature I don't want to tackle in the near term

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

To run all checks from main, comment on the PR with @rerun-bot full-check.

@Wumpf Wumpf added exclude from changelog PRs with this won't show up in CHANGELOG.md 🎞️ video labels Sep 17, 2024
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

crates/viewer/re_data_ui/src/blob.rs Show resolved Hide resolved
ui.list_item_flat_noninteractive(PropertyContent::new("Duration").value_text(
format!(
"{}",
re_log_types::Duration::from_millis(video.duration_ms() as _)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also show the number of frames in the video?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had this in for a moment but then removed it again because it requires iterating over all the samples of a video. Which isn't terribly expensive and could be cached, but then I saw that video players only do this upon read and usually carefully talk about samples, not frames 🤔
@jprochazk what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

putting it in for now, but calling it Sample count instead. I figure the contention with "frames" is that it may refer to full frames/iframes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would be careful about this. Some people may think that num_frames / duration = fps, but that's not true, videos may have variable frame rate. At the same time, we don't want to overload users with video codec/container specific stuff that they have to understand, and for all intents and purposes one sample = one frame.

Copy link
Member Author

@Wumpf Wumpf Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, thx! I'll leave a note in the code so the next person doesn't reconsider too quickly
(also keeping sample count for the moment)

crates/viewer/re_data_ui/src/blob.rs Show resolved Hide resolved
crates/viewer/re_renderer/src/video/mod.rs Outdated Show resolved Hide resolved
crates/viewer/re_space_view_spatial/Cargo.toml Outdated Show resolved Hide resolved
Comment on lines +42 to +43
if response.clicked() {
self.ui().ctx().copy_text(error_text.to_owned());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice touch, but there is no affordance that tells the user that they can copy the error with a click.

@gavrelina may have a better idea here, but some alternatives:

  • Show "Click to copy" in a tooltip on hover
  • Make the text selectable instead
  • Add a 📋 button next to the message instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for context: I copied this from the "small" error text method above. But I do agree!

Copy link
Member Author

@Wumpf Wumpf Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our 📋 icon is too ugly for this (also tried adding it to the regular error_label, but it's just too ugly). going with the minimum here for now whcih is selectable + tooltip

crates/viewer/re_viewer_context/src/cache/video_cache.rs Outdated Show resolved Hide resolved
@Wumpf Wumpf merged commit 30f2877 into main Sep 19, 2024
32 of 33 checks passed
@Wumpf Wumpf deleted the andreas/improved-video-error-reporting branch September 19, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md 🎞️ video
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn on unsupported video
3 participants