|Date:||05 Jul, 2012|
Elliot Woods Developed with support from Lumacoustics, UK
BlackMagic Design produce some pretty interesting products in the video market. Of particular interest to VVVV users is the Intensity range of products http://www.blackmagic-design.com/products/intensity/ which allows a computer to capture video live from another video source (e.g. a laptop, a video camera) over a range of video connectors (HDMI, composite, component), and the Intensity product is available in a number of packages (USB3.0, PCIe, thunderbolt). They start at $200.
An example usage scenario would be to generate visuals on computer A (e.g. this could be a Mac running Modul8), output them on DVI and connect this to the HDMI input of the BlackMagic Intensity, and then capture that content into VVVV as a texture.
Traditionally this has been possible using DirectShow, but this route has always caused noticeable latency (which increases over time). Using this plugin introduces near-zero latency (as fast as the card will allow).
bjeorn below states 2-3 frames latency between PC A's monitor when capturing and presenting on PC B's monitor by videoing a counter on both screens.
Use the ListDevices (DeckLink) node to give you IDeckLink devices, which you then can plug into the VideoIn (DeckLink EX9.Texture) node. Make sure to select the correct video mode on the VideoIn node to correspond with the signal being sent to the capture device (this is not automatic).
Note that the texture output from the plugin is in a strange YUV format, and to decode it, you will need to use the YUV2RGB TextureFX (supplied in this package).
If your computer is very slow (or very busy), then it may not be able to keep up with the capture device, in which case it will begin to buffer frames to make sure that you don't miss anything. In this case, if you do want to improve the latency of the stream, then bang the Flush input of VideoIn to flush the cache (feel free to attach a toggle to flush every frame).
- Notes on YUV2RGB
I found the data which comes out from the BlackMagic Intensity to be in YUV format (UYVY). On my system (ATI 6770, Intel Core i7 * 4/4), I couldn't get any of the native DirectX YUV texture formats to work. Furthermore, I found decoding the data on the CPU to be a serious issue in C# as it doesn't allow for native 8-bit math (it casts to 32-bit integers whenever you perform an operation which may result in overflow). There are 2 formats offered by SlimDX (YUY2 and Uyvy) which would be ideal, but trying to create one of these textures threw an error on my system (often these texture types can be GPU specific). In the end, the cleanest/quickest solution seemed to be to ship the data to the GPU and decode it there.
What does YUVtoRGB do?
So YUV is a colour encoding which reformats the RGB information in order of visual importance:
- Y = lightness
- U = distance from blue
- V = distance from red
Often we transmit images with full resolution Y, but compressed resolution U and V, which is the case for the BlackMagic Intensity driver. A 4:2:2 pulldown takes every 2 pixels (RGBRGB=6 bytes) and stores it as (UYVY=4 bytes).
This means that 2 pixels are stored in 4 bytes. Since 4 bytes can be stored in a single RGBA pixel, this is what I did coming out of the VideoIn node. This is then decoded in a shader back into RGB.
Since each 'fake RGBA' pixel coming out of VideoIn is turned into 2 real RGB pixels, the resolution coming out of VideoIn is actually half the width of the final image.
As always, plugins might show some bugs when released in the wild. The first thing to do is check that your capture is working correctly in BlackMagic Media Express application. If you can see a live image in that application when in 'Log and Capture' mode (and having the right format set in Preferences) but you can't get it working in VVVV, then please comment below to help debug. If you can't get it working in Media Express, then please look into that first.
- Added 'Wait For Frame' options. See help patch for details]
- Added 'Frame Received' output message
- Fixed exception that sometimes occurred when changing video format.
CommentsComments are no longer accepted.
Please create a new topic in the vvvv beta forum to discuss this contribution.