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

Improve FrameInfo handling #8099

Merged
merged 11 commits into from
Nov 12, 2024
Merged

Improve FrameInfo handling #8099

merged 11 commits into from
Nov 12, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Nov 12, 2024

What

Added is_sync and make sure FrameInfo is either valid or None.

Checklist

@emilk emilk added 🧑‍💻 dev experience developer experience (excluding CI) exclude from changelog PRs with this won't show up in CHANGELOG.md 🎞️ video labels Nov 12, 2024
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

Fixes #8072 if understand correctly!

@@ -93,6 +93,11 @@ impl From<Error> for crate::decode::Error {
/// ffmpeg does not tell us the timestamp/duration of a given frame, so we need to remember it.
#[derive(Clone)]
struct FfmpegFrameInfo {
/// The start of a new [`crate::demux::GroupOfPictures`]?
///
/// If true, an entire frame can be decoded from this one sample,
Copy link
Member

Choose a reason for hiding this comment

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

I thought for very long that this was true. But now I'm not so sure anymore that we are guaranteed to get a frame back from a decoder when we enqueue such a frame.
I would have expected PTS==DTS on those, but that part I know for sure now is not the case.

One subtle problem with this statement that I'm a bit more sure about is that while we have a sample -> frame, it may still be that a frame needs meta information from other samples even though this is supposed to be an IDR frame.
For instance in AV1, the information we append right now in our annex_b stream in the ffmpeg decoder is dispersed over the samples of the video and I have no ideas if there's any guarantees at all.

With that in mind I'd be in favor for leaving this out of the doc comment & tooltip (affects a bunch of places where this is copy pasted) until we understand better what we're dealing with.

Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW, this is what Claude 3.5 believes:

image

…but I'm sure it's mostly trained on common misconceptions

Copy link
Member

Choose a reason for hiding this comment

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

had mixed success with LLMs in this area. And I've got too often burned by now believing the simple answers :/

Copy link
Member

Choose a reason for hiding this comment

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

not a strong conviction here as described.
What bugs me about all this is that the is_sync is derived in quite strange way in the mp4 crate which I don't follow and I'd rather have per codec defined things that are easier to look up :(

Copy link
Member

Choose a reason for hiding this comment

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

we obviously depend on it meaning something though as it governs our enqueuing strategy

Copy link
Member

Choose a reason for hiding this comment

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

maybe just slap a We generally assume in front of it 🤷

crates/store/re_video/src/decode/mod.rs Show resolved Hide resolved
Comment on lines +42 to +43
"{} {}:{} {}",
record.level(),
Copy link
Member

Choose a reason for hiding this comment

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

what is this? I'm lacking context

Copy link
Member Author

Choose a reason for hiding this comment

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

context

Copy link
Member

Choose a reason for hiding this comment

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

I meant

  • why does it make it better - before/after
  • what has this to do with anything in this pr

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 like to flip that switch so I can see where a log message comes from.
Before I couldn't see the log level when I did so. Now I can.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

It was completely unrelated to the PR, except I wanted to debug "what the hell is wring that annoying log message"

@emilk emilk merged commit 925fec3 into main Nov 12, 2024
36 checks passed
@emilk emilk deleted the emilk/investigate-video-timestamps branch November 12, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧑‍💻 dev experience developer experience (excluding CI) 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.

"Current decoded frame" shows garbage data for frames that aren't decoded yet
2 participants