Skip to content

Changing the video codec from VP8 to H.264 #3345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 22 commits into
base: livekit
Choose a base branch
from

Conversation

fkwp
Copy link
Contributor

@fkwp fkwp commented Jun 18, 2025

Recent research has confirmed that the number of devices lacking H.264 decoding capabilities is negligible.

In contrast, many modern devices come equipped with native H.264 encoders and decoders. By switching to the H.264 codec, we can significantly reduce CPU usage. Especially mobile devices will benefit, where it can lead to better battery life.

Furthermore, we add a 540p simulcast video layer.

fixes #3166 #2579 #2373

@fkwp fkwp requested a review from a team as a code owner June 18, 2025 14:49
@fkwp fkwp requested a review from BillCarsonFr June 18, 2025 14:49
@fkwp fkwp added the PR-Improvement Release note category. A PR that improves EC's performance or stability. label Jun 18, 2025
@fkwp fkwp changed the title Changing the video codec from VP8 to H264 Changing the video codec from VP8 to H.264 Jun 18, 2025
@fkwp fkwp marked this pull request as draft June 18, 2025 15:13
@fkwp fkwp marked this pull request as draft June 18, 2025 15:13
Comment on lines 26 to 36
videoSimulcastLayers: [
VideoPresets.h180,
VideoPresets.h360,
VideoPresets.h540,
] as VideoPreset[],
Copy link

@spaetz spaetz Jun 18, 2025

Choose a reason for hiding this comment

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

I might be misunderstanding the livekit docs. But can we actually hand it three presets here? Livekit docs stated up to 2 custom layers. Or are those standard preset no custom layers?

videoSimulcastLayers: [VideoPreset]

custom video simulcast layers for camera tracks, defaults to h180, h360, h540.
You can specify**up to two custom layers** that will be used instead of the LiveKit default layers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope its limited to three in total including the base layer.

Copy link
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

Just a small comment regarding the loglevel

@@ -29,7 +29,7 @@ window.setLKLogLevel = setLKLogLevel;
initRageshake().catch((e) => {
logger.error("Failed to initialize rageshake", e);
});
setLKLogLevel("info");
setLKLogLevel("debug");
Copy link
Member

Choose a reason for hiding this comment

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

Is this on purpose? or a left over of a dev setup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is part of debugging why h264 with simulcast is not working on iOS devices.

VideoPresets,
} from "livekit-client";

const VideoPresetsH264 = {
Copy link
Contributor

Choose a reason for hiding this comment

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

what makes this specific H264 presets? Aren't those just regular presets that could also be used with other encordings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this PR is in draft -- this is part of debugging why h264 with simulcast is not working on iOS devices.

using h264 specific presets help finding out if the h264 macro-block constraint is the problem here.

Comment on lines +37 to +38
VideoPresetsH264.h144,
VideoPresets.h360,
Copy link
Contributor

Choose a reason for hiding this comment

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

why the mixture of VideoPresetsH264 and VideoPresets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Improvement Release note category. A PR that improves EC's performance or stability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selected video resolution often not that great (EC defaults lower than livekit defaults)
4 participants