Skip to content

Commit b80a36f

Browse files
committed
[*] improve openh264 encoder efficiency
1 parent 71e7422 commit b80a36f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/recorder/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ env_logger.workspace = true
5252
[features]
5353
default = ["wayland-wlr"]
5454
windows = ["openh264-video-encoder"]
55-
# wayland-wlr = ["dep:screen-capture-wayland-wlr", "x264-video-encoder"]
56-
wayland-wlr = ["dep:screen-capture-wayland-wlr", "openh264-video-encoder"]
55+
wayland-wlr = ["dep:screen-capture-wayland-wlr", "x264-video-encoder"]
56+
# wayland-wlr = ["dep:screen-capture-wayland-wlr", "openh264-video-encoder"] # For Debug on Linux
5757
wayland-portal = ["dep:screen-capture-wayland-portal", "x264-video-encoder"]
5858

5959
x264-video-encoder = ["dep:x264"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `Linux` platform uses `x264` (~12ms)
2+
- `Windows` platform uses `openh264` (~25ms)

lib/recorder/src/video_encoder/ve_openh264.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ impl OpenH264VideoEncoder {
2525
let encoder_config = EncoderConfig::new()
2626
.skip_frames(false)
2727
.profile(Profile::Baseline)
28-
.complexity(Complexity::High)
29-
.background_detection(false)
30-
.adaptive_quantization(false)
31-
.rate_control_mode(RateControlMode::Bufferbased)
32-
.usage_type(UsageType::ScreenContentRealTime)
28+
.complexity(Complexity::Low)
29+
.rate_control_mode(RateControlMode::Quality)
30+
.usage_type(UsageType::CameraVideoRealTime)
3331
.max_frame_rate(FrameRate::from_hz(config.fps.to_u32() as f32));
3432

3533
let encoder = Encoder::with_api_config(OpenH264API::from_source(), encoder_config)

0 commit comments

Comments
 (0)