-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Improve screen recording dimensions #43
Conversation
`navigator.mediaDevices.getDisplayMedia` provides less-than-actual video output, especially for HD, 4K, or HiDPI screen. This results in GIFs that look blurry due to downscaling. Adding this constrain results in original display scale, leading to a crisper output.
But this also makes it produce HUGE (as in bytes) gifs right? Related to #38 |
@joaomoreno Yes, it makes the GIF bigger, but gifcap consistently performs better than other screen recording solutions I've tried. From my research, it seems for gifcap the video input is lossless. This made a huge difference in the resulting size. ExampleThis GIF has resolution 1438x714 and is 13.77 seconds. From gifcap: 209 KB (128.6 Kb/s). For comparison, when I use other GIF screen recorders it usually produces files with bitrate of 1000 Kb/s. So gifcap is performing almost a magnitude better. Possible further optimizationSince this arguably makes the file size larger (in exchange for better quality gifs), there are ways to reduce size further. Using ffmpeg to optimize: 186 KB (114.46 Kb/s).
Using gif-inspector, it shows that gifcap creates frames with a rectangular area when there is a change. When optimized with ffmpeg, only pixels that are really changed remains. |
Yeah gifcap could optimize further, it currently only does one rectangle per frame: Line 86 in 854550f
Anyway, on this PR: can you explain how the 9999 works? I find it strange. 🤔 Is that an upper bound, or? https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/height |
@joaomoreno The number is the “ideal” dimension, if it cannot be obtained browser just choose the closest value.
I just picked the number 9999 out of thin air 😂 |
But why does it actually change anything? Without specifying it, your browser automatically scales down the media stream? What browser is this? Can you repro on other browsers? |
@joaomoreno Chrome on both MBP Retina (macOS) and Surface Pro 7 (Windows) scales the video down on HiDPI displays. Chrome scales 1080p screens down to 720p by default as well.
|
So weird. Thanks for the glitch link, really helpful. Also, thanks for the PR! |
navigator.mediaDevices.getDisplayMedia
provides less-than-actual video output, especially for HD, 4K, or HiDPI screen. This results in GIFs that look blurry due to downscaling. Adding this constrain results in original display scale, leading to a crisper output.Without this PR
With this PR
Userland patch