Sending pre-encoded video to peer

502 views
Skip to first unread message

Art Matsak

unread,
Apr 18, 2015, 5:17:10 PM4/18/15
to discuss...@googlegroups.com
We are looking to send pre-recorded video from a Linux server to a browser client via WebRTC. We have been able to achieve this by replacing the camera with a raw frames file as the video source (we used the FileVideoCapturer class for this). However, with this approach, the video obviously gets encoded with VP8 each time it is requested by the client.

Is it possible to encode the video with VP8 once and have the WebRTC engine push the pre-encoded stream to the other peer, bypassing the on-the-fly encoder altogether?


Eric Davies

unread,
Apr 19, 2015, 2:50:10 PM4/19/15
to discuss...@googlegroups.com

WebRTC changes the encoding of your video to meet network bandwidth constraints. That is to say, it throws out frames, reduce resolution, lowers quality. If you were sending the pre-encoded video directly, you'd lose out on this.

For pre-recorded video, you can take advantage of longer buffering to smooth out momentary network pauses, and you'd rather wait for video to arrive than lose any of it. In short, webRTC isn't the right tool for pre-recorded video.

dev33

unread,
Apr 21, 2015, 2:43:45 PM4/21/15
to discuss...@googlegroups.com
Could you please elaborate on this answer. How can it be suited for reading a stream from a device as long as the device is not a harddrive?

Eric Davies

unread,
Apr 21, 2015, 3:24:29 PM4/21/15
to discuss...@googlegroups.com
Think in terms of what you'd want for video conferencing, not youtube.
With a video conference, if packets are lost for a few seconds, you want to stay current, not be a few seconds behind the rest of the call.
If the network speed drops, you'd prefer a degraded picture rather than the alternative.

--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/nuNrNPfUFXo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Eric Davies

Jeremy Noring

unread,
Apr 21, 2015, 6:33:29 PM4/21/15
to discuss...@googlegroups.com
On Saturday, April 18, 2015 at 3:17:10 PM UTC-6, Art Matsak wrote:
We are looking to send pre-recorded video from a Linux server to a browser client via WebRTC. We have been able to achieve this by replacing the camera with a raw frames file as the video source (we used the FileVideoCapturer class for this). However, with this approach, the video obviously gets encoded with VP8 each time it is requested by the client.

Is it possible to encode the video with VP8 once and have the WebRTC engine push the pre-encoded stream to the other peer, bypassing the on-the-fly encoder altogether?

Having implemented this in licode more or less (licode lets you play data from a file), it's surprisingly hard to do this.  Example: when a client requests a keyframe via a FIR request, it's impossible to fulfill that request because there isn't an encoder running on the fly: the stream is already encoded, so the client just has to wait until a keyframe comes along.  This also creates all sorts of race conditions on stream start, where if one side starts sending data before the other is ready, the receiver misses a keyframe and can't render the video.

Unless it's a huge burden, it's not worth the effort of getting rid of this encode.  Either that, or stop using WebRTC and swap over to using some playback streaming method (DASH, HLS, etc.).  Is there some reason typical HTTP streaming won't work for you?  It's *way* easier than using WebRTC.

Art Matsak

unread,
Apr 22, 2015, 11:53:46 AM4/22/15
to discuss...@googlegroups.com
Thank you for sharing your experience. We are also coming to a conclusion that streaming pre-encoded media with WebRTC may be too hard to justify any potential benefits.
Reply all
Reply to author
Forward
0 new messages