Skip to content
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

使用时ffmpeg占用大量内存 #54

Closed
ASC8384 opened this issue Dec 3, 2023 · 3 comments
Closed

使用时ffmpeg占用大量内存 #54

ASC8384 opened this issue Dec 3, 2023 · 3 comments
Labels
bug Something isn't working P1 second priority

Comments

@ASC8384
Copy link
Collaborator

ASC8384 commented Dec 3, 2023

图片
如图所示,内存总占用约 10G,请问这是正常现象吗?
主屏幕是4K屏。
顺便请问多屏开发的优先级高么

@Antonoko Antonoko added bug Something isn't working P0 highest priority labels Dec 3, 2023
@Antonoko
Copy link
Member

Antonoko commented Dec 4, 2023

在我的两台 64G RAM 电脑上均可以稳定复现,只要 ffmpeg 一录制就会快速占用到 6~7g 内存,随着时间推移缓缓增加,直到视频切片录制完毕、ffmpeg 退出。

看上去似乎是 ffmpeg 本身的问题,在使用最新版本 ffmpeg 情况下,只要运行录屏指令,就会复现占用大量内存的状况。尚且不清楚是 ffmpeg 本身存在内存泄露问题、亦或是它的缓存与运行策略即是如此🤔(会尽可能较多地动态占用与回收用户可用内存?)对内存较小的 PC 来说确实是个比较严重的性能问题,有待进一步调研。

「多屏开发」也是开发 roadmap 的一项,不过由于目前使用了 pyautogui 来做一些检测与处理操作,它还尚未加入多显示器支持,因此暂时还阻塞着🫨

@Antonoko Antonoko added P1 second priority and removed P0 highest priority labels Dec 4, 2023
@ASC8384
Copy link
Collaborator Author

ASC8384 commented Dec 6, 2023

请问有讨论群组吗?
偶尔 Recording 会停滞不动,webui 显示当前未在录制屏幕。 请刷新查看最新运行状态。,日志如下,但此时并没有爆内存,长时间不动或正常使用都偶尔会遇到这种情况,需要重启脚本才行。

frame= 1703 fps=1.9 q=0.0 size=    2048kB time=00:14:10.00 bitrate=  19.7[out#0/mp4 @ 000001f18f278dc0] video:2160kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.659762%
frame= 1800 fps=2.0 q=-1.0 Lsize=    2174kB time=00:14:58.50 bitrate=  19.8kbits/s speed=0.998x
[libx264 @ 000001f190dbe180] frame I:4     Avg QP: 1.50  size:293220
[libx264 @ 000001f190dbe180] frame P:205   Avg QP: 0.36  size:  2668
[libx264 @ 000001f190dbe180] frame B:1591  Avg QP: 0.56  size:   309
[libx264 @ 000001f190dbe180] consecutive B-frames:  0.3%  0.2%  0.2%  0.2%  0.3%  0.0%  0.8%  0.0% 98.0%
[libx264 @ 000001f190dbe180] mb I  I16..4: 59.3% 33.9%  6.8%
[libx264 @ 000001f190dbe180] mb P  I16..4:  0.5%  0.0%  0.0%  P16..4:  0.4%  0.0%  0.0%  0.0%  0.0%    skip:99.0%
[libx264 @ 000001f190dbe180] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0:40.4% L1:59.5% BI: 0.0%
[libx264 @ 000001f190dbe180] final ratefactor: -12.27
[libx264 @ 000001f190dbe180] 8x8 transform intra:27.2% inter:75.7%
[libx264 @ 000001f190dbe180] coded y,u,v intra: 11.8% 8.2% 6.9% inter: 0.0% 0.0% 0.0%
[libx264 @ 000001f190dbe180] i16 v,h,dc,p: 93%  3%  3%  1%
[libx264 @ 000001f190dbe180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  8% 81%  1%  0%  0%  0%  0%  0%
[libx264 @ 000001f190dbe180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 18% 15% 18%  4%  3%  3%  5%  3%
[libx264 @ 000001f190dbe180] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001f190dbe180] ref P L0: 92.0%  0.4%  3.7%  3.9%
[libx264 @ 000001f190dbe180] ref B L0: 74.4% 24.1%  1.6%
[libx264 @ 000001f190dbe180] ref B L1: 97.4%  2.6%
[libx264 @ 000001f190dbe180] kb/s:19.65

@Antonoko
Copy link
Member

“自动灵活截图(使用 MSS)”模式已加入,可以作为ffmpeg的替代方案,它的开销更低更节能、占用系统资源也更低

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 second priority
Projects
None yet
Development

No branches or pull requests

2 participants