Skip to content

Bad video output performance of arv-viewer  #323

Closed

Description

@mikekml

Describe the bug

There is error message on the screen while accessing the camera

** (arv-viewer-0.8:6438): WARNING **: 18:26:00.964: Failed to make stream thread high priority

arv-viewer-0.8 is running with 66MB/s and 44 FPS and visible latency between object movement and display on the screen.

moreover while monitoring in top or jtop ( for jetson ) - arv-viewer consumes 250% CPU in user mode while pylon only 45%

To Reproduce
Compile and run arv-viewer on AGX Xavier with latest jetpack with Basler camera connected to USB3 port. All default settings.

install basler pylon 5.2 and run on the same system to see the difference in FPS

Expected behavior

Basler Pylon 5.2 proprietary software works with the same camera on the same board with 300MB/s read and 200 FPS frame rate and no visible latency.

Camera description:

  • Basler
  • acA1440-220um
  • USB3

Platform description:

  • Aravis version 0.8 ( aravis-0.7.3 build )
  • OS: Jetpack [L4T 32.2.3] / Ubuntu 18.04 provided by Nvidia JetPack
  • NVIDIA Jetson AGX Xavier

Additional context
Add any other context about the problem here.

Activity

  1. EmmanuelP commented on Dec 15, 2019

    @EmmanuelP
    Contributor

    Yes, the performance of the video display in arv-viewer is really lacking, not only on ARM platform like AGX Xavier. It is mostly an issue in gtksink gstreamer element. You should be able to obtain better performances using a gstreamer pipeline with autovideosink or ximagesink.

    I would be interested in the performance figures of the data streaming (buffer read without any display or processing). What is the CPU use of arv-camera-test with the maximum FPS ?

  2. added
    1. Enhancement
    5. Viewer
    on Dec 15, 2019
  3. changed the title [-]Basler USB3V performance with arv-viewer-0.8 [/-] [+]Bad video output performance of the arv-viewer [/+] on Dec 15, 2019
  4. changed the title [-]Bad video output performance of the arv-viewer [/-] [+]Bad video output performance of arv-viewer [/+] on Dec 15, 2019
  5. mikekml commented on Dec 16, 2019

    @mikekml
    Author

    Hi Emanuel,

    here is the log of arv-camera-test

    Looking for the first available camera
    vendor name = Basler
    model name = acA1440-220um
    device id = (null)
    image width = 1440
    image height = 1024
    horizontal binning = 1
    vertical binning = 1
    payload = 1474560 bytes
    exposure = 1000 µs
    gain = 11 dB
    uv bandwidth limit = -1 [524288..419430400]
    Frame rate = 110 Hz
    Frame rate = 125 Hz
    Frame rate = 124 Hz
    Frame rate = 124 Hz
    ^CFrame rate = 124 Hz
    Completed buffers = 607
    Failures = 0
    Underruns = 0

    It looks like the framerate is now better, but it is still around half of what PylonViewer can pull of the camera

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    24679 argos 20 0 199724 83444 6132 S 55.1 0.5 0:16.93 arv-camera-test

    CPU usage is less, but kernel load is still way higher then in pylon case.

    %Cpu(s): 1.7 us, 7.8 sy, 0.0 ni, 83.3 id, 0.0 wa, 7.1 hi, 0.1 si, 0.0 st

    Im new to gstreamer and Aravis. can you please provide more info on how to use

    gstreamer pipeline with autovideosink or ximagesink and Aravis viewer

    thanks and regards,
    -Mike

  6. jajberni commented on Dec 17, 2019

    @jajberni
  7. jajberni commented on Dec 17, 2019

    @jajberni
  8. EmmanuelP commented on Dec 17, 2019

    @EmmanuelP
    Contributor

    @jajberni Please open another issue, GigEVision and USB3Vision aravis codes have nothing in common.

  9. deleted a comment from mikekml on Dec 17, 2019
  10. EmmanuelP commented on Dec 17, 2019

    @EmmanuelP
    Contributor

    @mikekml could you try with arv-camera-test -f 200 ?

  11. EmmanuelP commented on Dec 17, 2019

    @EmmanuelP
    Contributor

    Im new to gstreamer and Aravis. can you please provide more info on how to use gstreamer pipeline with autovideosink or ximagesink and Aravis viewer

    @mikekml from the meson build directory, try: ./gst/gst-aravis-launch aravissrc ! videoconvert ! ximagesink

  12. to266 commented on Dec 17, 2019

    @to266

    I have a similarly pool performance of the aravis-viewer on Nvidia Jetson TX2 with JAI GO-5100M via usb3.

    Could post the arv-camera-test a bit later, as currently the CPU is super loaded by other things, and it would bias..

  13. to266 commented on Dec 17, 2019

    @to266

    On a desktop hardware the same camera was able to support around 73fps at the same full resolution, and thus the test:

    $ ./arv-camera-test -f 75
    Looking for the first available camera
    vendor name           = JAI Corporation
    model name            = GO-5100M-USB
    device id             = (null)
    image width           = 2464
    image height          = 2056
    horizontal binning    = 1
    vertical binning      = 1
    payload               = 5065984 bytes
    exposure              = 1286 µs
    gain                  = 10 dB
    uv bandwidth limit     = 0 [0..-1]
    Frame rate = 43 Hz
    Frame rate = 37 Hz
    Frame rate = 32 Hz
    Frame rate = 34 Hz
    ^CFrame rate = 30 Hz
    Completed buffers = 176
    Failures          = 0
    Underruns         = 0
    
    $ ./gst/gst-aravis-launch aravissrc ! videoconvert ! ximagesink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstAravis:aravis0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, width=(int)2464, height=(int)2056, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1
    /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)2464, height=(int)2056, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1, format=(string)BGRx
    /GstPipeline:pipeline0/GstXImageSink:ximagesink0.GstPad:sink: caps = video/x-raw, width=(int)2464, height=(int)2056, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1, format=(string)BGRx
    /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, width=(int)2464, height=(int)2056, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1
    WARNING: from element /GstPipeline:pipeline0/GstXImageSink:ximagesink0: A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2902): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstXImageSink:ximagesink0:
    There may be a timestamping problem, or this computer is too slow.
    /GstPipeline:pipeline0/GstAravis:aravis0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, width=(int)2145, height=(int)1578, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1
    /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)2145, height=(int)1578, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1, format=(string)BGRx
    /GstPipeline:pipeline0/GstXImageSink:ximagesink0.GstPad:sink: caps = video/x-raw, width=(int)2145, height=(int)1578, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1, format=(string)BGRx
    /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, width=(int)2145, height=(int)1578, framerate=(fraction)74/1, pixel-aspect-ratio=(fraction)1/1
    WARNING: from element /GstPipeline:pipeline0/GstXImageSink:ximagesink0: A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2902): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstXImageSink:ximagesink0:
    There may be a timestamping problem, or this computer is too slow.
    WARNING: from element /GstPipeline:pipeline0/GstXImageSink:ximagesink0: A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2902): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstXImageSink:ximagesink0:
    There may be a timestamping problem, or this computer is too slow.
    WARNING: from element /GstPipeline:pipeline0/GstXImageSink:ximagesink0: A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2902): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstXImageSink:ximagesink0:
    There may be a timestamping problem, or this computer is too slow.
    ERROR: from element /GstPipeline:pipeline0/GstXImageSink:ximagesink0: Output window was closed
    Additional debug info:
    ximagesink.c(697): gst_x_image_sink_handle_xevents (): /GstPipeline:pipeline0/GstXImageSink:ximagesink0
    Execution ended after 0:00:39.192048720
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...
    

    Not sure if the computer is actually too slow as the warning above says?

  14. mikekml commented on Dec 17, 2019

    @mikekml
    Author

    @mikekml could you try with arv-camera-test -f 200 ?

    Hi Emanuel,

    we found in one of the older versions of aravis implementation of asynchronous bulk request handling which, in our case, worked better than the latest version synchronous implementation.

    when we traced libusb during pylon execution - we noticed asynchronous bulk request handling as well.

    once we ran the older version, we got maximal frame rate from our camera ( 227 FPS ), but the throughput that we saw ( using usbtop ) on respective usb end point was significantly lower than when running with pylon.

    we managed to get to the throughput similar to pylon after changing the following constants

    // #define ARV_UV_STREAM_MAXIMUM_TRANSFER_SIZE (102410241)
    // #define ARV_UV_STREAM_MAXIMUM_SUBMIT_TOTAL (810241024)

    to

    #define ARV_UV_STREAM_MAXIMUM_TRANSFER_SIZE (65536) // similar to pylon
    #define ARV_UV_STREAM_MAXIMUM_SUBMIT_TOTAL (1555200) // similar to pylon

    after the above changes + async bulk, arv-camera-test behaves exactly as pylon.

    however, when we run arv-viewer, built from the same source, the frame-rate/ usb throughput drop x3 ..

    additional observation: after the above changes there is no latency in real-time video in arv-viewer.

    i haven't check the source code yet, but my assumption is that it somehow drops frames, but it is showing latest frames such that there is no visual latency in video. ( by visual latency i mean an effect when you wave your hand quickly in front of the camera and it appears tens of milliseconds after the actual waving - this is what happening with latest versions with synchronous bulk handling ).

    so far so good.

    the question is whether it will be possible to bring async bulk request handling to upstream versions ? it looks like it may be very useful for high speed cameras, like the one that we have.

    thanks and regards,
    -mike

  15. mikekml commented on Dec 17, 2019

    @mikekml
    Author

    Im new to gstreamer and Aravis. can you please provide more info on how to use gstreamer pipeline with autovideosink or ximagesink and Aravis viewer

    @mikekml from the meson build directory, try: ./gst/gst-aravis-launch aravissrc ! videoconvert ! ximagesink

    works only in latest ( meson ) versions. tried to run it - it looks like it works faster than arvplayer, but it does not support window resize, etc and in general is not as robust as viewer app.

    also, observed that it is way less cpu hungry than the viewer.

    from my perspective it will be interesting to test it with async bulk handling.

  16. dmitryalferov commented on Dec 17, 2019

    @dmitryalferov
    Contributor

    the throughput that we saw ( using usbtop ) on respective usb end point was significantly lower than when running with pylon.

    Hi @mikekml, I think I've encountered similar behaviour and it turned out to be a bug in a libpcap (used by usbtop). Due to this bug packet lengths on the usbmon binary interface were delivered incorrectly, see this issue for more information about this bug.

    In my case actual throughput was the same for both pylon and aravis (I've verified that via usbmon text interface), even though reported transmission via usbtop was 16 times less for aravis.

    Ultimately I wouldn't rely on the usbtop readings that much.

  17. mikekml commented on Dec 18, 2019

    @mikekml
    Author

    the throughput that we saw ( using usbtop ) on respective usb end point was significantly lower than when running with pylon.

    Hi @mikekml, I think I've encountered similar behaviour and it turned out to be a bug in a libpcap (used by usbtop). Due to this bug packet lengths on the usbmon binary interface were delivered incorrectly, see this issue for more information about this bug.

    In my case actual throughput was the same for both pylon and aravis (I've verified that via usbmon text interface), even though reported transmission via usbtop was 16 times less for aravis.

    Ultimately I wouldn't rely on the usbtop readings that much.

    we noticed that too, but it is till useful to see relative changes between different runs
    the main problem as i see it is in async bulk request vs sync bulk request handling. it looks like async works better

  18. EmmanuelP commented on Dec 19, 2019

    @EmmanuelP
    Contributor

    @mikekml , @crabsmaps Please comment on USB3Vision performance in #324

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. Enhancement5. Viewer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions