Skip to main content

Slow video saving

Inactive

Comments

8 comments

  • TDY_William
    Community team
    Great answers
    Expert (Gold)

    Hi Gregory,

    For saving video (assuming h264 compressed video format), and jpeg format (which is a compressed format), then saving to disk requires processing the image object into a compressed format.  This processing is done by the CPU, and usually acts as the blocker when trying to save compressed images/videos in a high bandwidth setup. So upgrading the CPU would be one option to improve performance.

    Alternatively, if you try to capture video/images at a faster camera framerate with no other changes, without enough buffers associated to the application, images will be dropped. In that case, you can assign a larger amount of buffers/RAM to the application to compensate.  So long as your camera finishes capturing images before completely filling up the RAM of the PC, this would allow you to save your images/video to disk without dropping frames.

    Finally, reducing the quality of the compression (compression quality for jpeg, bitrate for h264 avi) would allow for faster framerate performance, so reducing it slightly would potentially show negligible changes to image quality, while improving the max framerate you can save images/video at.

    0
  • Grégory BAERT
    Idea generator
    Great answers

    Hello,

    Thank you for this detailed feedback.

    Actually, I tried saving directly after capturing the images, just to be sure, and quite a few frames are missing from the video.

    For example, a 1-minute video recording is actually only 23 seconds long after recording.

    How can I assign a larger amount of buffers/RAM to the application  ?

    Best regards,

    0
  • TDY_William
    Community team
    Great answers
    Expert (Gold)

    well, lets assume you are running at 131 fps (full framerate for camera at default resolution), default resolution (1.9MP), and 8bit (1byte) pixel format.  running for 60 seconds, the bandwidth can be calculated as:
    131 * 1.9 * 1 * 60 = 14,934 MB (~15GB).  Now, if you were to capture all of the frames, without converting and appending the images to the video at the same time, then you would need 15GB's of RAM to accommodate all of the images.  

    Details on how to assign buffers, and how buffer handling works in general, can be found in the BufferHandling example code (included with the Spinnaker SDK) and application note:
    https://www.teledynevisionsolutions.com/en-ca/support/support-center/application-note/iis/understanding-buffer-handling/

    One other note is to make sure the three fps values are matching.  The three framerates are the camera framerate, the framerate the video is saved at, and the playback speed of the video when reviewing (this last value would be dependent upon the video playback application you are using to view the video).  

     

    0
  • Grégory BAERT
    Idea generator
    Great answers

    Hello,

    Thank you for your reply. Is there a way to test these parameter changes with SpinView ? (before changing anything in the code )

    Best regards,

     

    0
  • TDY_William
    Community team
    Great answers
    Expert (Gold)

    Buffers can be changed in SpinView. In SpinView, select the camera, then in the features tab, use the search bar to search for "buffer".  With stream buffer mode set to "manual" and stream buffer handling Mode set to "Oldest First", you can then increase the "Manual Stream Buffer Count" to your desired value.  Please note that this would be limited by your available RAM, and your current camera settings (resolution/region of interest and pixel format).  Your current max buffers is shown as "Stream Buffer Count Max". 

    0
  • Grégory BAERT
    Idea generator
    Great answers

    Hello,

    Thank you for your reply. I tested the features related to “buffer” in spinView.

    However, as my application also streams live video, I set the mode to “Newest Only”.

    If I select “Oldest first” mode, will I no longer have the live video stream ?

    Best regards,

    0
  • TDY_William
    Community team
    Great answers
    Expert (Gold)

    Yes.  There are pros and cons to each.  For Newest Only, you are guaranteed to have the latest image displayed, but you may be skipping frames to do so.  For Oldest First, so long as you have sufficient RAM, you are seeing all of the frames the camera is capturing, but the delay is increasing as time goes on, causing what is being seen on the screen something that occurred more and more in the past, rather than what is happening now. 

    Keep in mind however, this is only when trying to run at too high a bandwidth, while saving images/video to disk. Reduce that bandwidth to something the computer can do comfortably for your given scenario, and both buffer handling modes can act as a "live stream".  

    0
  • Grégory BAERT
    Idea generator
    Great answers

    Hello,

    I have carried out various tests, including changing the video quality to 75 set to MJPEG: for a 10-second video with a frame rate of 131.6 fps, saving takes 50 seconds.

    In addition, I tried to perform a backup at the same time as the acquisition on the hard drive using “ImageEventHandlerImpl”, but it does not work at all; the video is incorrectly configured (no fps, no height or width, etc.).

    Best regards,

    0

Please sign in to leave a comment.

Powered by Zendesk