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

1

1

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.

Sidra answered 11/11, 2015 at 13:27 Comment(1)
From #libav, user JEEB helped me. The first question is resolved (using -vf "scale=640:480" -sws_flags "neighbor"), the second is a matter of tests, the third has no much sense... but there's a big problem with the FPS (edited to clarify it). When I resolve this last issue, I'll post a complete answer.Sidra
N
-1

Try with using the framerate option for x11grab.

Nellie answered 13/11, 2015 at 5:57 Comment(1)
I didn't find the difference with "-r", but "-framerate" does not solve the problem.Sidra

© 2022 - 2024 — McMap. All rights reserved.