You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
APPLICATION: HTTP API get the number of frames received or sent for FPS. #851
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.
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.
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.
Activity
portl4t commentedon Apr 20, 2017
amazing
winlinvip commentedon 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):
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_GPT3Jeff885 commentedon Apr 20, 2017
Good
winlinvip commentedon Apr 23, 2017
Merge SRS2 for #851
winlinvip commentedon Apr 24, 2017
The time interval for updating Frames data is configured as follows:
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_GPT3Trojann commentedon Jul 31, 2020
Can I get duration of live from HTTP API, and what live_ms mean?
Fix ossrs#851, HTTP API support number of video frames for FPS. 2.0.240