react-native-nodemediaclient icon indicating copy to clipboard operation
react-native-nodemediaclient copied to clipboard

How can set camera to HD or full HD?

Open cybercoder opened this issue 5 years ago • 9 comments

When i set preset=4 it just resize video size, no HD or full HD capture from Camera. The server and Android camera both tested using Larix Broadcasterand i see full HD there.

cybercoder avatar Dec 05 '19 18:12 cybercoder

My camera setup is as below, still I am getting low quality video.

<NodeCameraView 
  style={styles.nodeCameraView}
  ref={(vb) => { this.vb = vb }}
  outputUrl = {`rtmp://live.mux.com/app/${this.state.streamId}`}
  camera={{ cameraId: 0, cameraFrontMirror: true }}
  audio={{ bitrate: 32000, profile: 1, samplerate: 44100 }}
  video={{ 
    preset: 4,
    bitrate: 400000,
    profile: 2,
    fps: 30,
    videoFrontMirror: false
  }}
  autopreview={true}
/>

Anyone have any idea to improving quality ?

kishanbharda avatar Jan 15 '20 13:01 kishanbharda

@cybercoder @kishanbharda did you managed to fix?

ManigandanRaamanathan avatar Mar 24 '20 17:03 ManigandanRaamanathan

@cybercoder @kishanbharda did you managed to fix?

No there is problem with Native part and i don't know native programming.

cybercoder avatar Mar 26 '20 14:03 cybercoder

@cybercoder @kishanbharda @ManigandanRaamanathan

Hi, I know this answer is kinda late. I've just used this library for a project of ours and had the same problems. I managed to get the quality better though

Turned out the bitrate option is essential see below:

<NodeCameraView
  outputUrl={RTMP_URI}
  camera={{cameraId: 1, cameraFrontMirror: true}}
  audio={{bitrate: 32000, profile: 1, samplerate: 44100}}
  video={{
    preset: 1,
    bitrate: 32000000,
    profile: 0,
    fps: 30,
    videoFrontMirror: true,
  }}
  autopreview={true}
/>

the video bitrate takes bit units and not KB. so for HD720 1280x720 video it is recommended to have 4,000 kbps of bitrate. by conversion 4,000 kbps is 3.2e+7 ~ 32,000,000 (correct me if I'm wrong)

With the fix above the camera streams better quality on our project now. try it out and would appreciate if you could tag me here if things don't work on your end

Thanks

BoyKagud avatar Apr 20 '20 10:04 BoyKagud

"preset" is used to set the video resolution. The reference for this value is as follows: https://github.com/NodeMedia/NodeMediaClient-iOS/blob/master/docs/NodePublisher_API_CN.md#videopreset

illuspas avatar Apr 20 '20 10:04 illuspas

@BoyKagud How did you determine that it was in bits?

It's definitely not KB but I can't find where in the source code it specifies it as bits.

agconti avatar Nov 20 '20 22:11 agconti

@agconti did you find out something about this ? Thank you !

adrien-prototype avatar Dec 09 '20 14:12 adrien-prototype

@agconti did you find out something about this ? Thank you !

(Unfortunately) no

cybercoder avatar Jan 26 '21 14:01 cybercoder

Does anyone here is aware of a high level solution to stream rtmp to MUX from a react-native app ? I would really really really appreciate any help 🙌 Thank you !

adrien-citrus avatar Apr 29 '21 17:04 adrien-citrus