kclyu / rpi-webrtc-streamer

This repo's objective is providing something like Web Cam server on the most popular Raspberry PI hardware. By integrating [WebRTC](https://webrtc.org/native-code/) and Raspberry PI, we can stream the Raspberry camera feed to browser or native client which talks WebRTC.
Other
617 stars 108 forks source link

Change codec to VP8 #100

Closed AlexanderBykin closed 3 years ago

AlexanderBykin commented 4 years ago

Hi Is it possible to change Codec from current H.264 to VP8 ?

AlexanderBykin commented 4 years ago

i look at the source, that is impossible, maybe someone can suggest local based streaming server that can handle H.264 stream and encode them to client supported codec?

kclyu commented 4 years ago

With raspberry pi CPU performance, vp8 is encoded at a low fps of 640x480. Decoding h.264 and encoding it as vp8 again puts a load on cpu performance.

If you need to encode with vp8, you can get it as a raw frame and encode it with vp8, but I can't recommend using it in raspberry pi. As mentioned above, video fps and delay are not good.

AlexanderBykin commented 4 years ago

maybe you can suggest external republishing server that can do that?

kclyu commented 4 years ago

There is a way to use a transcoding component(MCU), but it is quite expensive to use and deploy. It seems difficult to say that a particular product or opensource package is best.

If you need to use vp8, I think it is better to use hardware that can accelerate the encoding of vp8 codec or CPU performance.

By the way, is there any reason to use vp8?

AlexanderBykin commented 4 years ago

yes reason is: Android does not decode H264 frames that came from WebRTC, for test i use Chrome web browser. readings from internet suggest to use VP8 for Android

kclyu commented 4 years ago

Android also does h.264 decoding, it is because the smart phone model that uses a specific GPU does not support h.264. Actually, there are not many such smart phone models, but these models create the same issue.

The performance of the PI4 has improved a lot, and later models will have better CPU performance, so even if the quality is slightly deteriorated, it is time to consider the vp8 software encoding.

AlexanderBykin commented 4 years ago

i try to use your streamer in my project but in case of small supported percent of Android devices i rollback to MJPEG-streamer

kclyu commented 4 years ago

Most Android models support h.264 codec. Some Android models do not support it.

Even using Software VP8 encoding, it never achieves performance similar to hardware encoding. So, RWS didn't include VP8 codec, and even later, PI4 or the above PI version could not show hardware encoding performance.

I don't know how much MJPEG latency comes out, but for me, I would use rws for supported models and mjpeg for unsupported models.

Whatever you use, it's your decision. It's a good idea to use what suits your purpose.