apivideo / api.video-reactnative-live-stream

React Native RTMP live stream client. Made with ♥ by api.video
https://api.video
MIT License
177 stars 33 forks source link

gop, keyframes #42

Closed nikitapilgrim closed 1 year ago

nikitapilgrim commented 1 year ago

Can I change this setting (keyframes)? I need to set it from 2-8 sec

ThibaultBee commented 1 year ago

Hi, There is no way to set the gop size in the API yet. Why would you need these requirements?

nikitapilgrim commented 1 year ago

your library can be used for a custom server. It would be great if you could pass more options

ThibaultBee commented 1 year ago

yeah, but an increase of the gop means that if you lost a packet at the beginning of the gop (packet loss is likely to happen in live streaming), the live stream will be altered for up to X seconds which can be a long period. 8 seconds is a long period for a viewer. So, we don't understand why you require to increase gop size. We need to understand the use case and the reason behind this before adding such settings.

nikitapilgrim commented 1 year ago

https://www.facebook.com/help/1534561009906955?cms_id=1534561009906955&published_only=true https://support.google.com/youtube/answer/2853702?hl=en they recommend a minimum of 2 seconds everywhere. I can't use this library with different services right now because I can't change the keyframe to at least 2 seconds

nikitapilgrim commented 1 year ago

I would be very grateful if you could implement this or suggest an alternative

ThibaultBee commented 1 year ago

A gop of 2s is a recommended settings for these platform not a requirement. Right? For which services are you stuck?

nikitapilgrim commented 1 year ago

I have this problem with cloudflare live stream

Stream supports a maximum ingest bitrate of 12000 Kbps. You must set GOP durationOpen external link (keyframe interval) of between 2 to 10 seconds. The default in most encoding software, including Open Broadcaster Software (OBS), is within this range. Setting a lower GOP duration will reduce latency for viewers, while also reducing encoding efficiency. Setting a higher GOP duration will improve encoding efficiency, while increasing latency for viewers. This is a tradeoff inherent to video encoding, and not a limitation of Cloudflare Stream. Closed GOPs are required. This means that if there are any B frames in the video, they should always refer to frames within the same GOP. This setting is default in most encoding software such as OBS. Stream Live only supports H.264 video and AAC audio codecs as inputs. This requirement does not apply to inputs that are relayed to Stream Connect outputs. Stream Live supports ADTS but does not presently support LATM.

ThibaultBee commented 1 year ago

Hi,

A parameter gopDuration has been added to the native dependencies:

It will be integrated in the RN part soon.

ThibaultBee commented 1 year ago

I just added a gopDuration param in the video object. Could you that this issue is fixed in the main branch?

nikitapilgrim commented 1 year ago

I just added a gopDuration param in the video object. Could you that this issue is fixed in the main branch?

Yes it works. Only for some reason there is no sound :( But the video shows as it should

nikitapilgrim commented 1 year ago

Stream Live only supports H.264 video and AAC audio codecs as inputs. This requirement does not apply to inputs that are relayed to Stream Connect outputs. Stream Live supports ADTS but does not presently support LATM.

Can you tell me if this could be a problem?

ThibaultBee commented 1 year ago

I just added a gopDuration param in the video object. Could you that this issue is fixed in the main branch?

Yes it works. Only for some reason there is no sound :( But the video shows as it should

On Android or iOS?

Stream Live only supports H.264 video and AAC audio codecs as inputs. This requirement does not apply to inputs that are relayed to Stream Connect outputs. Stream Live supports ADTS but does not presently support LATM.

Can you tell me if this could be a problem?

No, it should not.

ThibaultBee commented 1 year ago

The reason you have issue with the audio stream is that the audio is muted by default due to a regression. Thanks for noticing.

ThibaultBee commented 1 year ago

Could you retest on the main branch?

nikitapilgrim commented 1 year ago

Yes there is sound now. And the camera starts quickly

ThibaultBee commented 1 year ago

This should be fixed in v1.2.2.