shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.
https://docs.haishinkit.com/swift/latest
BSD 3-Clause "New" or "Revised" License
2.78k stars 618 forks source link

How can I get the actual bitrate of a streaming video? #700

Closed allenlinli closed 4 years ago

allenlinli commented 4 years ago

Is your feature request related to a problem? Please describe. No. I wonder if the actual video bitrate is different from the bitrate we are setting in RTMPStream (with rtmpStream.videoSettings[H264Encoder.Option.bitrate])? Because the bitrate our server receive (700 Kbps) is different from the bitrate I set (1000 Kbps) in RTMPStream.

Describe the solution you'd like A actualBitrate property to provide the real bitrate, if there is such a thing.

Describe alternatives you've considered

Additional context AudioConverter has a property actualBitrate, it could be the reference.

shogo4405 commented 4 years ago

rtmpStream.videoSettings[.bitrate] means a average bitrate

A actualBitrate property to provide the real bitrate, if there is such a thing.

rtmpStream.info.currentBytesPerSecond https://github.com/shogo4405/HaishinKit.swift/blob/master/Sources/RTMP/RTMPStreamInfo.swift#L9

allenlinli commented 4 years ago

Great! I understood. Thank you for the explanation.