How to reduce CPU consumption by using avconv and pipe it to avplay?

十年热恋 提交于 2019-12-11 23:31:21

问题


See FINAL EDIT.

I need to capture the second monitor and show in main display in a small window. I don't need quality, but performance.

So, the (working) command to capture second monitor of 1280x1024 and show it in a 640x480 window at 15fps and horizonatally flipped, would be (from askUbuntu):

avconv -f x11grab -r 15 -s 1280x1024 -i :0.1 -c:v mpeg4 \
  -b:v 1000k -s 640x480 -vf "hflip" -f avi - | avplay -i -
  • How to scale with "None" interpolation?
  • I used "-c:v mpeg4" and "-b:v 1000k" to have a good image quality, but... is there any other format/bitrate to reduce at minimum the CPU consumption?
  • I know that horizontal flipping is a basic effect, but is there any way to tell avconv to reduce CPU by using -vf option?
  • When the playing window stars showing, its 15fps is respected. But then, it gets lower and lower progresively to gets freezed... until I click the window. Then, it is rises to 15fps and gets lower again. Why it is like this and how to avoid it? I tried to use "nice -n-20" with both avconv and avplay, but it makes no difference.

When I say that I need performance, not quality, I say that it's more important to save CPU... but I don't want to see a full-of-low-compression-artifacts video.

I'm on Ubuntu-Mate 14.04.

Thanks!

FINAL EDIT: the command would be:

avconv -f x11grab -r 30 -s 1280x1024 -i :0.0+1920 -c:v mpeg4 \
-b:v 1000k -vf "hflip" -vf "scale=640:480" -sws_flags "neighbor" \
-f avi - | avplay -i -

But the framerate issue is not solved and it consumes 16-18% CPU. In this question, there is the Gstreamer option, with gst-launch: it consumes 2-4% CPU. So, the avconvert/avplay option is not usefull for me.


回答1:


Try with using the framerate option for x11grab.



来源:https://stackoverflow.com/questions/33651546/how-to-reduce-cpu-consumption-by-using-avconv-and-pipe-it-to-avplay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!