Add VP8 encoding through WEBRTC#47
Conversation
fe96a92 to
81426c2
Compare
| allowed_origins: List[str] = Field( | ||
| title="Allowed Origins", | ||
| description="List of allowed origins for CORS", | ||
| default=[], | ||
| ) |
There was a problem hiding this comment.
I added this field, to make it possible, to correctly configure the CORS middleware of the application. It currently only works for the VP8 encoding, mainly because in that case we would need additional HTTP Methods, namely POST to create the WebRTC method, while MPEG1 and MJPEG only used one websocket connection
| try: | ||
| await asyncio.wait_for(pc.close(), timeout=2) | ||
| except asyncio.TimeoutError: | ||
| print("Timeout while closing peer connection, closing forcefully...") |
There was a problem hiding this comment.
The pc connections here often might not close gracefully, if a user is still connected on its browser, when we stop the application, hence the forcefull shutdown after timeout is needed
|
I chose VP8 for this PR, because it is less expensive in the encoding, as for example, VP9 or AV1, is royalty-free, and supported by all browsers. The addition of VP9 and/or AV1 later should be straightforward |
This PR aims to add an additional encoding method to the
video-streamer, namely VP8. To achieve this, we useWebRTCto establish an RTC connection with a client.Compared to previous methods, this would allow clients to make use of the
<video>tag and related browser-integrated performance improvements.