-
Notifications
You must be signed in to change notification settings - Fork 135
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
base: livekit
Are you sure you want to change the base?
Conversation
src/livekit/options.ts
Outdated
| videoSimulcastLayers: [ | ||
| VideoPresets.h180, | ||
| VideoPresets.h360, | ||
| VideoPresets.h540, | ||
| ] as VideoPreset[], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
3c08780 to
717bd1c
Compare
|
What is the status on this one? Can the OP get a description what this is blocked by. (I do remember some device specific issues where some resolution just were not send at all?) |
H264 video is still broken on iOS — other participants won’t receive video from an iOS device. This happens when the iOS device is the first to join a LiveKit room and starts streaming H264. However, it's working if a non-iOS client is already streaming H264 before the iOS device joins. Note Using VP8 on the other client does not fix the issue — it must be H264. |
|
Test on safari on mac os works. |
| screenShareEncoding: ScreenSharePresets.h1080fps30.encoding, | ||
| stopMicTrackOnMute: false, | ||
| videoCodec: "vp8", | ||
| videoCodec: "h264", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| videoCodec: "h264", | |
| videoCodec: platform === "ios" || !useH264Setting ? "vp8" : "h264", |
Adding a dev setting for using h264 would allow merging this and would provide us more data on how this behaves in real live.
Let me know if I should update this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fkwp any thoughts on this? This would also be nice to have in the 15 release ?
|
bump, any progress on this? what is blocking it? how about iOS 26? 👀 |
still blocked on Safari as h264 with e2ee as a first joiner with Safari does not work. |
|
so this is not fixable until safari itself changes? which might never happen |
UpdateThings have changed after rebasing it on a large refactor including numerous livekit udpates. Those are the observations compared to previous ones:
This is not the case anymore. Its the opposite now: starting with iOS H264 (first to join the lk room) is realiably resulting in the other device receiving media. I do have slow network and matrix.org accounts (and matrix.org is also slow atm) so things might have started to work if i would have been a bit more patient
If another client streams VP8 before it OCCASIONALLY does not work (not work = the vp8 client cannot see the ios stream, ios can see both. the local echo stream and the vp8 stream) Both on vp8 seemed to always work. (independent on who joined first) Tested on: @shootie22 @thorw4ld If you want to help out on testing this proceed as following: Use this URL: |
|
@toger5 thats awesome, thank you so much! I will try to test it out tonight after I get home and report back. |
|
alright, I tested all combinations - result: as long as I'm using the EC version you provided on EX iOS, my phone will not transmit any video. I tested using: the combination of EC version or which device joined first didn't seem to matter, as long as my phone was using the PR version of EC, it would send no video. :( I will note that my phone does indeed get hot. I don't think I noticed until now, but it gets hot on either version, stable or the one from this PR. is there anything specific you'd like me to test or look for, perhaps in the developer menu? |
|
Very nice initiative. But why h264 instead of h265? h265 on the other hand, has no licensing concerns as long hardware codec is used. A lot of modern chips (2018 and onwards) have both hardware encoding and decoding. Chrome supports it since the beginning of 2025, safari as well. Using h265 with a fallback to vp8 would improve both quality and performance for many users as it's hardware accelerated and provides better compression. Additionally it can unlock 1080p for many devices that were constrained by cpu before (its target bitrate is 3Mbps at 1080p, the same as vp8 at 720p). |
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
Current state
H264 video is still broken on iOS — other participants won’t receive video from an iOS device. This happens when the iOS device is the first to join a LiveKit room and starts streaming H264.
However, it's working if a non-iOS client is already streaming H264 before the iOS device joins. Note Using VP8 on the other client does not fix the issue — it must be H264.