Skip to content

feat: add resolution and bitrate information to API responses#5333

Closed
JeanLeao wants to merge 1 commit intobluenviron:mainfrom
JeanLeao:feat/resolution-info
Closed

feat: add resolution and bitrate information to API responses#5333
JeanLeao wants to merge 1 commit intobluenviron:mainfrom
JeanLeao:feat/resolution-info

Conversation

@JeanLeao
Copy link

@JeanLeao JeanLeao commented Jan 9, 2026

Hi everyone! This is my first contribution to a project I really enjoy, and I hope this change can help others.
This PR adds resolutions and bitrates fields to the API...

What changed

  • Added resolutions and bitrates fields to the API (/v3/paths/list and /v3/paths/get/{name}).
  • Centralized resolution extraction in the codecprocessor package for H.264, H.265, MPEG-4, and MPEG-1.
  • Updated OpenAPI documentation and tests.

Why

  • Previously, there were times when I needed to get the resolution and bitrate from the camera, and there was nothing in the API to guide me the first time.
  • I believe this complements the existing API fields, enriching the API and making it more useful for developers.
  • These details have helped me a lot in stream monitoring, so I wanted to share them here hopefully, they’re useful for everyone.

How it works

  • Resolutions come from codec parameters (SPS for H.264/H.265, config for MPEG-4/MPEG-1).
  • Bitrate is calculated as an average based on time and received bytes.
  • All values are validated to prevent invalid data.

Testing and notes

  • Tested with common streams and worked well.
  • There may be edge cases, like corrupted SPS or rare formats, that I haven’t covered fully. Feedback is welcome!
  • Local tests pass and nothing existing is broken.

Feedback is very welcome!
MediaMtx

@DoM1niC
Copy link

DoM1niC commented Jan 10, 2026

It is possible to add Framerate, can you add this for me ? 👍🏻

@JeanLeao
Copy link
Author

JeanLeao commented Jan 12, 2026

It is possible to add Framerate, can you add this for me ? 👍🏻

I can take a look at how to extract the framerate information, I haven’t tried this yet.

@DoM1niC
Copy link

DoM1niC commented Jan 17, 2026

I see you extract informations from H264+H265 what is about AV1?

@JeanLeao
Copy link
Author

I didn’t include AV1 because I didn’t need it for my case, but I can take a look at it later if necessary.
The frame rate was implemented, but it showed inconsistencies and ended up being too specific to my use case. Since VLC didn’t provide reliable results as a reference, I decided not to include it.

@aler9
Copy link
Member

aler9 commented Mar 17, 2026

Hello,
Bitrates can already be extracted from the bytesReceived and bytesSent fields.
Resolutions are now provided by the more comprehensive #5585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants