Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
755 stars 196 forks source link

[REQUEST]: Byte[] from cam.CaptureStream #668

Open lukaszmoskwa opened 2 years ago

lukaszmoskwa commented 2 years ago

Is your feature request related to a problem?

I'm not sure whether I'm missing this feature or not, but I wasn't able to find it in the documentation. I would like to retrieve a byte[] from a MediaStream (in particular a MediaStreamTrack like a video), encoded as webm vp8 and send it in a different way with respect to the RTCPeerConnection.

This is actually possibile in other libraries in the browser that retrieve the UserMedia and store it in an array of byte buffers with a custom slice. Here I report an example from RecordRTC (https://recordrtc.org/ - check the timeSlice parameter in the configuration)

Describe the solution you'd like

If it's not already present, I would like to suggest to add a listener that would enable to retrieve the byte array

videoStream = cam.CaptureStream(1280, 720, 1000000);
videoStream.onDataAdded = data => {
    // Here data is a byte[] containing the video recorded in a certain timeSlice
}

Describe alternatives you've considered

Actually, I was thinking about taking the single images and using ffmpeg to convert them to webm vp8, but it really looks like an overkill to me

Additional context

No response

karasusan commented 2 years ago

Is it a same issue? https://github.com/Unity-Technologies/com.unity.webrtc/issues/635

Or, do you want to record the streaming video?

lukaszmoskwa commented 2 years ago

I actually want to record the streaming video

kannan-xiao4 commented 2 years ago

memo: WRS-281