com.unity.webrtc icon indicating copy to clipboard operation
com.unity.webrtc copied to clipboard

[REQUEST]: Byte[] as video stream

Open ZeoWorks opened this issue 3 years ago • 9 comments

Is your feature request related to a problem?

Hello,

I was wondering if there is a way to send a byte array as the video stream as opposed to a RenderTexture? The reason for this is that we're feeding a raw h264 ffmpeg stream into unity and hoping to push the byte[] over webRTC instead of using CaptureStream (ie. var videoStream = cam.CaptureStream(1280, 720, 1000000);).

Thanks!

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

ZeoWorks avatar Feb 23 '22 12:02 ZeoWorks

@ZeoWorks I got your issue. Thank you for the feedback!

karasusan avatar Mar 08 '22 02:03 karasusan

Thank you! Has this been implemented? The byte[] will be pre-encoded h264 raw data, thanks again.

ZeoWorks avatar Mar 09 '22 12:03 ZeoWorks

@karasusan I guess this is not easy to implement. H264 encoder in native code is closely related other modules. We need to make new one which not process encoding, and path byte data through to downstream.

karasusan avatar Mar 10 '22 10:03 karasusan

@karasusan I guess this is not easy to implement. H264 encoder in native code is closely related other modules. We need to make new one which not process encoding, and path byte data through to downstream.

Sounds like just removing the middle man. Instead of passing through to OpenH264 or the Nvidia SDK, we send the byte[] video stream directly over.

ZeoWorks avatar Mar 13 '22 20:03 ZeoWorks

@ZeoWorks Usually, the bandwidth changes dynamically according to network environment, so it might not work only support the dummy encoder. I guess we need to support the callback called when changing network bitrate.

karasusan avatar Mar 15 '22 02:03 karasusan

@ZeoWorks Usually, the bandwidth changes dynamically according to network environment, so it might not work only support the dummy encoder. I guess we need to support the callback called when changing network bitrate.

Yes, even a callback would do. :) The intent is to allow other developers to utilize custom third party encoding plugins. Thanks!

ZeoWorks avatar Mar 17 '22 21:03 ZeoWorks

@ZeoWorks FYI, Sounds like you want to make the custom encoder. This idea close to WebCodecs. https://www.w3.org/TR/webcodecs/

karasusan avatar Mar 23 '22 02:03 karasusan

Hi. :) Once again, we've already done this; we're using ffmpeg to push raw h264 byte[] data into Unity and all we need now is for com.unity.webrtc to read the data as media input.

ZeoWorks avatar Mar 25 '22 15:03 ZeoWorks

memo: WRS-321

kannan-xiao4 avatar Apr 26 '22 02:04 kannan-xiao4