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

APPLICATION: HTTP API get the number of frames received or sent for FPS. #851

Closed
winlinvip opened this issue Apr 20, 2017 · 6 comments
Closed
Assignees
Labels
Feature It's a new feature. TransByAI Translated by AI/GPT.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Apr 20, 2017

To get the FPS, SRS must provide the number of frames, user can get it from HTTP API.
For example, the number of frames is 1000, duration 100s, then the FPS is 10=1000frames/100s.

@winlinvip winlinvip added the Feature It's a new feature. label Apr 20, 2017
@winlinvip winlinvip added this to the srs 2.0 release milestone Apr 20, 2017
@portl4t
Copy link

portl4t commented Apr 20, 2017

amazing

@winlinvip
Copy link
Member Author

winlinvip commented Apr 20, 2017

Generally, frame rate calculation requires calculating a certain time difference, such as 10-second fps, or 30-second fps, or 300-second fps, to reflect the sending and receiving situation of the stream.
For example, data can be collected every 10 seconds (the minimum statistical interval):

In the first 10 seconds, the number of frames obtained is 1000.
In the second 10 seconds, the number of frames obtained is 1500.
In the third 10 seconds, the number of frames obtained is 1700.

So, for the first 10 seconds, the fps=(1500-1000)/10=50fps.
For the second 10 seconds, the fps=(1700-1500)/10=20fps.
For the first 30 seconds, the fps=(1700-1000)/30=23.33fps.

If the stream itself is 25FPS (original frame rate), then for the first 10 seconds, it is possible that the gop cache sent a higher frame rate. For the second 10 seconds, there is actually stuttering and the frame rate is insufficient. From 30 seconds onwards, the frame rate is slightly lower.

How to determine the original frame rate of the stream? The configuration on the encoder can be checked by accessing the encoder's interface or through the business system. The frame rate provided by SRS is the distributed frame rate.

TRANS_BY_GPT3

@Jeff885
Copy link

Jeff885 commented Apr 20, 2017

Good

@winlinvip
Copy link
Member Author

frames

winlinvip added a commit that referenced this issue Apr 23, 2017
@winlinvip
Copy link
Member Author

winlinvip commented Apr 24, 2017

The time interval for updating Frames data is configured as follows:

        # the normal packet timeout in ms for encoder.
        # default: 5000
        normal_timeout      5000;

The update can be done by setting the timeout for receiving packets. It should not be set too short, otherwise the encoder will be considered timed out, usually 3-5 seconds or more.

The calculation of FPS itself is not real-time because when TCP sends packets, it is more like pulses and not sending one packet at a time, but rather in batches. Therefore, adjusting this time interval to 1 second does not make sense, and it will not affect the calculation of FPS even if it is set to 3-5 seconds or more.

TRANS_BY_GPT3

@Trojann
Copy link

Trojann commented Jul 31, 2020

Can I get duration of live from HTTP API, and what live_ms mean?

@winlinvip winlinvip self-assigned this Sep 17, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature It's a new feature. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

4 participants