mbari-org / vars-annotation

Video Annotation Application for MBARI's Media Management (M3) software stack
https://docs.mbari.org/vars-annotation/
Apache License 2.0
16 stars 6 forks source link

Implement framecapture for Blackmagic Design devices #49

Closed hohonuuli closed 2 years ago

hohonuuli commented 6 years ago

We were using AVFoundation to capture images from video feeds into Blackmagic Designs hardware. That doesn't work anymore. Blackmagic is pushing everyone to use their C++ SDK. VARS needs a framecapture implementation for their SDK. This is only to support real-time and tape annotations. For video annotations, framecapture is implemented in Sharktopoda and jsharktopoda.

hohonuuli commented 6 years ago

Requested additional resources (another coder) to work on this.

hohonuuli commented 6 years ago

Created:

hohonuuli commented 6 years ago

Ran into an issue with tapes. When the RS422 connection starts, it activates the decklink card and the card will appear in AVFoundation. We can set the "Blackmagic Decklink SDI" card in settings and it will stick until settings is reopened. Users can then use framecpature with no issues. (Except first frame is black. Need to take empty frame whenever AVFoundationImageCapture is initialized). The Blackmagic device will disappear until VARS connects via RS422. Very confusing for the users.

hohonuuli commented 6 years ago

Another issue. When we use the Decklinks cards RS422 port, we can't connect using the Blackmagic API as it will detect the card as in use already. So we can't use that RS422 port and our shiny blackmagic design image capture API.

hohonuuli commented 6 years ago

When using blackmagics external boxes (rather than PCI card) we may run into the same VCR control/image capture API issue where the image capture sees the device as already in use. So it won't work with it.

hohonuuli commented 6 years ago

So, the lowest hanging fruit for now is to get the blackmagic API working with real-time annotations.

hohonuuli commented 5 years ago

We're having issues with blackmagic devices using the CamTwist/Syphoon setup.

hohonuuli commented 5 years ago

For tapes without epoch seconds written to the userbits, a framegrab would have a timestamp of 1970-01-01T00:00:00:00. The image files are named time_idx--video_reference_uuid.ext. The time-idx was would be which ever of these was found first: recorded_timestamp, timecode, elapsedtime. Since the recorded_timestamp was always the same, it would be submitting the same name to panoptes over and over. Panoptes would say no way as this image URL already exists, causing an error in the annotation app. The fix was to switch the time-idx lookup order to:

  1. timecode
  2. elapsed time
  3. recorded timestamp
lindakuhnz commented 5 years ago

New VARS app just now, restarted computer, Black Siphon, Simple Client, CamTwist open, frame grabs folder mounted. Can't frame grab from D1003 (01/12/2018 dive), or V3473 (12/17/2009 dive)

hohonuuli commented 5 years ago

Ok. I have no trouble framecapturing from D1003-04HD using the same setup. I'll stop by to see what's going on.

Note: You do not need to mount the framegrabs folder. That's no longer used by VARS.

hohonuuli commented 5 years ago

Note from Kyra:

I tested frame capture from tape on my machine and it is working.

lindakuhnz commented 5 years ago

1) On ALL computers (even those that are using the capture card (not the Black Magic external capture box), like the left hand one in the digital lab, you still need to use the applications Black Syphon and CamTwist. These apps have been added to that computer.

2) In VARS preferences, reset the Image Capture Input to MacOs native and Cam Twist every time you reinstall a new version of VARS.

3) USER must be selected before the frame grab icon becomes usable.

lonnylundsten commented 5 years ago

In the latest version of the BlackMagic designs SDK they provide a sample app called CaptureStills that might solve this issue. I built it and called it from python and java and it works great, grabs images without issues. You might want to try this again this demo did not exist before.

hohonuuli commented 2 years ago

Blackmagic support has been implemented in a separate MBARI internal project (libbmagic). Support for it has been added to VARS.