<div dir="ltr">Hi List,<div><br></div><div>I'm new to both gstreamer and Raspberry Pi, so please bear with me. Here are a few simple questions you can probably answer from the top of your head, and thanks in advance!</div><div><br></div><div>My config is Raspberry Pi B+ (single core 700MHz) and PlayStation Eye (USB camera + microphone), running gstreamer-0.10.</div><div><br></div><div>Basically I ran 3 tests with the video capture with the following command to compare CPU usage:</div><div><br></div><div><div>$ watch -d -n 2 ps -C gst-launch-0.10 -o %cpu,%mem,cmd</div></div><div><br></div><div>Test 1 (converting to RGB and sample at 30 fps): </div><div><br></div><div>$ gst-launch-0.10  v4l2src ! autovideoconvert ! videorate ! video/x-raw-rgb, format=RGB3, depth=24, framerate=<b>30/1</b>, width=320, height=240 ! autovideoconvert ! fakesink<br></div><div><br></div><div>CPU was at 25%.</div><div><br></div><div>Then I wondered whether I can improve over this 25%, one nature thought was to lower the sample rate from 30/1 to 5/1:</div><div><br></div><div>Test 2 (sampling at 5/1 instead of 30/1):</div><div><br></div><div>$  gst-launch-0.10  v4l2src ! autovideoconvert  ! videorate ! video/x-raw-rgb, format=RGB3, depth=24, framerate=<b>5/1</b>, width=320, height=240 ! autovideoconvert ! fakesink</div><div><br></div><div>CPU usage jumped to 70%!!</div><div><br></div><div>Note that this camera is able to do 120 fps at 320x240 (according to <a href="http://en.wikipedia.org/wiki/PlayStation_Eye">Wikipedia</a>), or 60 fps at 320x240 according to v4l2-ctl output (appended below), so I ran test 3:</div><div><br></div><div>Test 3 (sampling at 60/1 instead of 30/1):<br></div><div><br></div><div><div>$ gst-launch-0.10  v4l2src ! autovideoconvert ! videorate ! video/x-raw-rgb, format=RGB, depth=24, framerate=60/1, width=320, height=240 ! autovideoconvert ! fakesink</div></div><div><br></div><div>CPU was around 50%.</div><div><br></div><div>Then here are 3 questions:</div><div><br></div><div>1. Could someone explain to me why this CPU usage:</div><div>5fps: 70%</div><div>30fps: 25%</div><div>60fps: 50%</div><div><br></div><div>2. My application needed RGB, that's why I was converting to it (x-raw-rgb). To do computation on the <b>appsink</b> end, currently I do this: still sample at 30 fps (because CPU is lowest at 25%), but in my application for every 6 frames I drop 5, thus I'm in fact processing at a speed of 5 fps. This leaves enough CPU power to my appsink. Does this make sense?</div><div><br></div><div>3. Is there any other way to get lower than 25% CPU?</div><div><br></div><div>4. This deals with audio, that has been bugging me a bit. If I print the duration of each audio buffer, like the following in python:</div><div><br></div><div>print appsink.emit('pull-buffer').duration/1000000.0<br></div><div><br></div><div>For "alsasrc" I get a constant 10ms, but for "pulsesrc" I've seen 26ms, 36ms, and 46ms in different runs! Any idea?</div><div><br></div><div>Thank you!</div><div><br></div><div>Xuchen</div><div><br></div><div>P.S.,</div><div><br></div><div>The camera looks like this:</div><div><br></div><div>$ v4l2-ctl --all</div><div><br></div><div><br></div><div><div>Driver Info (not using libv4l2):</div><div><span class="" style="white-space:pre">    </span>Driver name   : ov534</div><div><span class="" style="white-space:pre">     </span>Card type     : USB Camera-B4.09.24.1</div><div><span class="" style="white-space:pre">    </span>Bus info      : usb-bcm2708_usb-1.2</div><div><span class="" style="white-space:pre">     </span>Driver version: 3.12.22</div><div><span class="" style="white-space:pre">    </span>Capabilities  : 0x85000001</div><div><span class="" style="white-space:pre">                </span>Video Capture</div><div><span class="" style="white-space:pre">              </span>Read/Write</div><div><span class="" style="white-space:pre">         </span>Streaming</div><div><span class="" style="white-space:pre">          </span>Device Capabilities</div><div><span class="" style="white-space:pre">        </span>Device Caps   : 0x05000001</div><div><span class="" style="white-space:pre">                </span>Video Capture</div><div><span class="" style="white-space:pre">              </span>Read/Write</div><div><span class="" style="white-space:pre">         </span>Streaming</div><div>Priority: 2</div><div>Video input : 0 (ov534: ok)</div><div>Format Video Capture:</div><div><span class="" style="white-space:pre">  </span>Width/Height  : 640/480</div><div><span class="" style="white-space:pre">   </span>Pixel Format  : 'YUYV'</div><div><span class="" style="white-space:pre">    </span>Field         : None</div><div><span class="" style="white-space:pre">   </span>Bytes per Line: 1280</div><div><span class="" style="white-space:pre">       </span>Size Image    : 614400</div><div><span class="" style="white-space:pre">   </span>Colorspace    : SRGB</div><div>Streaming Parameters Video Capture:</div><div><span class="" style="white-space:pre">   </span>Capabilities     : timeperframe</div><div><span class="" style="white-space:pre">  </span>Frames per second: 60.000 (60/1)</div><div><span class="" style="white-space:pre">   </span>Read buffers     : 2</div><div><br></div><div>User Controls</div><div><br></div><div>                     brightness (int)    : min=0 max=255 step=1 default=0 value=0 flags=slider</div><div>                       contrast (int)    : min=0 max=255 step=1 default=32 value=32 flags=slider</div><div>                     saturation (int)    : min=0 max=255 step=1 default=64 value=64 flags=slider</div><div>                            hue (int)    : min=-90 max=90 step=1 default=0 value=0 flags=slider</div><div>        white_balance_automatic (bool)   : default=1 value=1</div><div>                       exposure (int)    : min=0 max=255 step=1 default=120 value=253 flags=inactive, volatile</div><div>                 gain_automatic (bool)   : default=1 value=1 flags=update</div><div>                           gain (int)    : min=0 max=63 step=1 default=20 value=255 flags=inactive, volatile</div><div>                horizontal_flip (bool)   : default=0 value=0</div><div>                  vertical_flip (bool)   : default=0 value=0</div><div>           power_line_frequency (menu)   : min=0 max=1 default=0 value=0</div><div>                      sharpness (int)    : min=0 max=63 step=1 default=0 value=0 flags=slider</div><div><br></div><div>Camera Controls</div><div><br></div><div>                  auto_exposure (menu)   : min=0 max=1 default=0 value=0 flags=update</div></div><div><br></div><div><br></div></div>