我正在构建一个应用程序,其中必须记录我的桌面。我决定使用gstreamer,因为我正在使用c++开发我的应用程序。我使用ximagesrc来记录我的dekstop。代码中的代码行如下所示
gst_parse_launch("ximagesrc ! queue ! videoscale ! video/x-raw-rgb,width=640,height=480,framerate=30/1 ! queue ! ffmpegcolorspace ! theoraenc ! queue ! oggmux ! filesink location=test.ogg",&error);我可以录制桌面。我使用的是2 GB内存的双核计算机。但我的问题是,当我播放录制的视频时,它有时会播放,有时会挂起。我不能完全依赖这一点。有什么解决方案吗?还是我在这里做错了什么?
发布于 2013-01-24 20:33:32
我在gstreamer的论坛上发布了同样的问题,并得到了一些很好的回应。其中一个提到使用" use -damage=0“和ximagesrc。我也降低了帧率。它看起来像这样。
gst_parse_launch("ximagesrc use-damage=0 ! queue ! videoscale ! video/x-raw-rgb,width=640,height=480,framerate=10/1 ! queue ! ffmpegcolorspace ! theoraenc ! queue ! oggmux ! filesink location=test.ogg",&error);这工作得很好,之后机器就不再挂起。我认为最主要的原因是,当你使用use-damage=0时,它会发送屏幕的更新,而不是整个屏幕。因此,它也减少了cpu,并提高了性能。
https://stackoverflow.com/questions/14442719
复制相似问题