Skip to content

Conversation

@pilot-whale
Copy link

Set encoder frame rate based on max_fps argument if provided.

Problem: The video encoder always uses the display refresh rate as its own framerate, while the --max_fps argument only reduces the number of frames sent to the encoder. This mismatch results in blurry frames, particularly when the --max_fps is significantly lower than the display refresh rate.

Tested on: fedora43 linux + sway

Let me know if anything needs to be adjusted.

Set encoder frame rate based on max_fps argument if provided.
@pilot-whale
Copy link
Author

currnet recording quality
wl-screenrec --audio --bitrate "1 MB" --low_power=off -m 60

current.mp4

modified recording quality
wl-screenrec -m 60 --low_power=off --audio --bitrate "1 MB"

output.mp4

Tested on: fedora43 linux + sway + 540hz fixed display refresh rate

Copy link
Owner

@russelltg russelltg left a comment

Choose a reason for hiding this comment

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

I'm somewhat surprised that this affects quality at all, but a good find regardless.

src/main.rs Outdated
enc.set_frame_rate(Some(framerate));

let encoder_framerate = if let Some(max_fps) = args.max_fps {
Rational(max_fps as i32, 1)
Copy link
Owner

Choose a reason for hiding this comment

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

This will handle fractional framerates poorly, and also it should prob be min(max_fps, display_framerate) yeah?

Better handle fractional framerate.
Select min(max_fps, framerate) as encoder framerate.
Copy link
Owner

@russelltg russelltg left a comment

Choose a reason for hiding this comment

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

sorry i wasn't clearer about exactly how i wanted this done

Copy link
Author

@pilot-whale pilot-whale left a comment

Choose a reason for hiding this comment

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

Sorry,I did not get you clearly earlier.

@pilot-whale pilot-whale requested a review from russelltg January 12, 2026 05:21
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.

2 participants