google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

stream sceneform cameraview #537

Open kulnaman opened 5 years ago

kulnaman commented 5 years ago

I am trying to stream the camera feed of the sceneform using RTMP as there is no support for such .What is the way for achieving that?

tpsiaki commented 5 years ago

Streaming the camera feed is possible using the surface mirroring functionality exposed through SceneView. At a high level, streaming the camera feed would require:

  1. Get an input Surface from an Android MediaCodec that will allow the rendered frames to be encoded as a video stream.
  2. Mirror the SceneView to this Surface using SceneView.startMirroringToSurface
  3. Run the MediaCodec encoder pipeline to produce encoded video packets that can be used in a video streaming protocol. You may find more relevant information on working with MediaCodec for streaming video on Stack Overflow