FfmpegWithOpenCVForUnityExample icon indicating copy to clipboard operation
FfmpegWithOpenCVForUnityExample copied to clipboard

Example of integrating "FFmpeg for Unity" with "OpenCV for Unity"

Ffmpeg With OpenCVForUnity Example

FfmpegWithOpenCVForUnityExample

Overview

  • Integrate "FFmpeg for Unity" with "OpenCV for Unity".
  • Replace WebCamTextureToMatHelper with FfmpegToMatHelper.
  • Video from a network camera (distributed via RTSP) is received by ffmpeg, converted to OpenCV's Mat class, and image processing is performed.

Environment

Setup

  1. Download the latest release unitypackage. FfmpegWithOpenCVForUnityExample.unitypackage
  2. Create a new project. (FfmpegWithOpenCVForUnityExample)
  3. Import and Setup OpenCV for Unity.
    • Download Dnn model files by ExampleAssetsDownloader. download_dnn_models.png
    • Move the files from the "OpenCVForUnity/StreamingAssets/" folder to the "Assets/StreamingAssets" folder. move_streamingassetsfolder.png
  4. Import and Setup FFmpeg for Unity.
  5. Import Runtime Inspector & Hierarchy.
  6. Import In-game Debug Console.
  7. Import FfmpegWithOpenCVForUnityExample.unitypackage.
  8. Set the URL of RTSPServer you wish to receive. ffmpeg_rtsp_settings.png
  9. Add the "Assets/FfmpegWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window.
  10. Build and Deploy. setup.png

ScreenShot

screenshot01.png screenshot02.png