Dual‑channel video + audio recorder for FLIR/Teledyne cameras using Spinnaker SDK, OpenCvSharp, and NAudio.
Designed for Windows, Visual Studio 2022, and .NET Framework 4.8.
- OS: Windows 10 / 11 (x64)
- IDE: Visual Studio 2022
- Framework: .NET Framework 4.8
- Platform target: x64 only
- C# language level: C# 7.3 (default for .NET Framework projects)
Spinnaker SDK (FLIR / Teledyne)
Spinnaker is not installed via NuGet. You must install the full Spinnaker SDK separately.
Requirements:
- Spinnaker SDK with .NET / C# support enabled
- USB3 or GigE transport layers installed
- SpinView must be able to stream the camera reliably
After installation, ensure this file exists:
C:\Program Files\Teledyne\Spinnaker\bin64\vs2015\SpinnakerNET.dll
Once started a VS project:
- Right click on the project > Add > Reference > Browse
- Add above file to the project.
FLIRCapture_2Ch/ │ ├── Devices/ │ ├── CameraDevice.cs │ └── AudioDevice.cs │ ├── Utilities/ │ ├── RecChannel.cs │ └── Config.cs │ ├── Form1.cs ├── Program.cs └── ReadMe.md
Install these via NuGet Package Manager:
-
NAudio
Audio device enumeration and WAV recording -
OpenCvSharp4
Video processing and encoding -
OpenCvSharp4.extension
-
OpenCvSharp4.runtime.win
Native OpenCV binaries (FFmpeg support)
- WinForms UI
- Enumerates cameras and microphones
- Handles Start / Stop for each channel
- Owns two
RecChannelinstances (_ch1,_ch2) - Receives preview frames via callback
- Handles global hotkey (Ctrl+Alt+Q)
Depends on:
- Utilities.RecChannel
- Devices.CameraDevice
- Devices.AudioDevice
Represents one recording channel:
- 1 camera + 1 microphone
- Owns: CameraDevice, AudioDevice
- Starts/stops both together
- Passes preview callback to UI
- Passes errors back to UI
Used by: Form1.cs
Handles all camera interaction:
- Spinnaker camera selection (by index)
- Camera initialization and configuration
- Acquisition loop (threaded)
- Mono vs color detection:
- Mono → Mono8
- Color/Bayer → BGR8 (HQ_LINEAR)
Video writing:
- MP4 (preferred)
- AVI MJPEG (fallback)
CSV logging:
- Frame index
- Monotonic timestamp (Stopwatch)
- Wall‑clock ISO time
- Status flags
Depends on:
- SpinnakerNET
- OpenCvSharp
- Utilities.Config
Handles microphone recording:
- Uses NAudio
- Records WAV audio
- Optional CSV timestamp logging (bin‑based)
- Sample‑accurate timing
- Safe start/stop/dispose
Used by: RecChannel.cs
Holds static configuration values:
public static class Config
{
public static class Camera
{
public const int FrameRate = 30;
public const double ExposureTimeMS = 10.0;
public const double GainValuedB = 2.0;
}
public static class Audio
{
public const int SampleRate = 384000;
public const int BitDepth = 16;
public const int Channels = 1;
}
public const double TimestampBinSizeSec = 0.02;
}In Visual Studio:
- Configuration: Debug or Release
- Platform: x64
- Any CPU will not work with Spinnaker
Mono vs Color Cameras
- Mono sensors handled natively (Mono8)
- Preview and video expanded to BGR for compatibility
- No fake color introduced
- SpinView streams camera for ≥60 seconds
- SpinnakerNET.dll referenced correctly
- NuGet packages restored
- Platform set to x64
- One camera tested first (Channel 1)
- Output folder selected in UI
Internal research / lab use. Adapt as needed for your specific camera models and acquisition modes.