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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/livekit/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,20 @@ import {
type RoomOptions,
ScreenSharePresets,
type TrackPublishDefaults,
type VideoPreset,
VideoPreset,
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.

h144: new VideoPreset(256, 144, 155_000, 20),
h240: new VideoPreset(480, 234, 160_000, 20),
h176: new VideoPreset(320, 176, 160_000, 20),
h288: new VideoPreset(382, 288, 180_000, 20),
// h360: VideoPresets.h360,
h360: new VideoPreset(640, 360, 450_000, 20),
h540: new VideoPreset(960, 540, 800_000, 20),
} as const;

const defaultLiveKitPublishOptions: TrackPublishDefaults = {
audioPreset: AudioPresets.music,
dtx: true,
Expand All @@ -23,10 +33,13 @@ const defaultLiveKitPublishOptions: TrackPublishDefaults = {
red: false,
forceStereo: false,
simulcast: true,
videoSimulcastLayers: [VideoPresets.h180, VideoPresets.h360] as VideoPreset[],
videoSimulcastLayers: [
VideoPresetsH264.h144,
VideoPresets.h360,
Comment on lines +37 to +38
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?

] as VideoPreset[],
screenShareEncoding: ScreenSharePresets.h1080fps30.encoding,
stopMicTrackOnMute: false,
videoCodec: "vp8",
videoCodec: "h264",
videoEncoding: VideoPresets.h720.encoding,
backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
} as const;
Expand Down
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

setLKLogExtension((level, msg, context) => {
// we pass a synthetic logger name of "livekit" to the rageshake to make it easier to read
global.mx_rage_logger.log(level, "livekit", msg, context);
Expand Down
Loading