Closed rranjan14 closed 1 year ago
Hi, All Android devices have H.264 encoders as specified here: https://developer.android.com/guide/topics/media/media-formats#video-formats As you can see VP8 and VP9 encoders are not mandatory. By the way, if you are looking to use VP8 or VP9 over RTMP, there aren't any official specification. Not sure about MPEG-TS (SRT container).
Anyway, I can add support for these encoders but as H.264 encoder are mandatory, I don't see the point.
Take these for e.g., Redmi K50i 5g, Xiaomi Mi 11 Ultra. When you'll check available codecs, you won't find H.264.
H.264 is only supported on Android devices with hardware support. VP8 is supported by all android devices. Many low-end android devices don't have that hardware support for H.264.
It'll really be great if you add support for vp8 and vp9 as well.
Have you try to found H.264 in these devices? Do you have the Redmi K50i and the Xiami Mi 11 Ultra? In that case, could you dump the video encoders list (screenshot, API, or xml)?
As I said, h.264 encoder are in every Android device, that's the Android specifications.
Unfortunately, I do not own these devices. But I can attach a few screenshots taken from DeviceSpecifications
Redmi K50i 5g:
Xiaomi Mi 11 Ultra:
Pixel 6(this has H.264, attaching just to point out the difference):
Also, attaching crash logs for Redmi K50i 5g:
Caused by java.security.InvalidParameterException: Failed to create codec for: {mime=video/avc, width=720, height=1280}
at io.github.thibaultbee.streampack.internal.encoders.MediaCodecEncoder.createCodec(MediaCodecEncoder.kt:185)
at io.github.thibaultbee.streampack.internal.encoders.VideoMediaCodecEncoder.createVideoCodec(VideoMediaCodecEncoder.kt:81)
at io.github.thibaultbee.streampack.internal.encoders.VideoMediaCodecEncoder.configure(VideoMediaCodecEncoder.kt:59)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.resetVideo(BaseStreamer.kt:364)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.stopStream(BaseStreamer.kt:321)
at io.github.thibaultbee.streampack.streamers.bases.BaseCameraStreamer.stopPreview(BaseCameraStreamer.kt:126)
at io.github.thibaultbee.streampack.streamers.bases.BaseCameraStreamer.release(BaseCameraStreamer.kt:134)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.configure(BaseStreamer.kt:243)
at video.api.livestream.ApiVideoLiveStream.setVideoConfig(ApiVideoLiveStream.kt:86)
at video.api.reactnative.livestream.ReactNativeLiveStreamView.setVideoConfig(ReactNativeLiveStreamView.kt:59)
at video.api.reactnative.livestream.ReactNativeLiveStreamViewManager.setVideoConfig(ReactNativeLiveStreamViewManager.kt:62)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:93)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:136)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:56)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:86)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:188)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:115)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1110)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1081)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1166)
at android.view.Choreographer.doCallbacks(Choreographer.java:920)
at android.view.Choreographer.doFrame(Choreographer.java:830)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1150)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8290)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:577)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
As there isn't any video encoder in the list, I guess that DeviceSpecifications is not reliatable in term of video encoders. For your crash, we already discuss it there: https://github.com/apivideo/api.video-reactnative-live-stream/issues/50.
This issue https://github.com/apivideo/api.video-reactnative-live-stream/issues/39 has already been fixed in StreamPack. You will have to wait for its integration in the api.video RN live stream.
Many android devices do not have H264/H265 encoders. But they do have either vp8 or vp9 encoder. How about extending support to these encoders as well?