Skip to content

Add VP8 encoding through WEBRTC#47

Open
walesch-yan wants to merge 1 commit into
mainfrom
yw-vp8-output
Open

Add VP8 encoding through WEBRTC#47
walesch-yan wants to merge 1 commit into
mainfrom
yw-vp8-output

Conversation

@walesch-yan

@walesch-yan walesch-yan commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

This PR aims to add an additional encoding method to the video-streamer, namely VP8. To achieve this, we use WebRTC to 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.

@walesch-yan
walesch-yan marked this pull request as ready for review July 7, 2026 15:53
Comment on lines +97 to +101
allowed_origins: List[str] = Field(
title="Allowed Origins",
description="List of allowed origins for CORS",
default=[],
)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread video_streamer/server.py
Comment on lines +148 to +151
try:
await asyncio.wait_for(pc.close(), timeout=2)
except asyncio.TimeoutError:
print("Timeout while closing peer connection, closing forcefully...")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@walesch-yan

Copy link
Copy Markdown
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant