8000 GitHub - raspberry4faith/python-opencv-gstreamer-examples: Python examples on how to use GStreamer within OpenCV. Now with GPU support! :fire::fire::fire:
[go: up one dir, main page]

Skip to content

raspberry4faith/python-opencv-gstreamer-examples

 
 

Repository files navigation

python-opencv-gstreamer-examples

Python examples for grabbing video devices (e.g. webcam, video, ...) and interacting with GStreamer (Shared Memory, RTP Stream). Updated for usage with Intel HD GPUs. NVIDIA examples as well as more complex stuff like splitting coming soon

  • (Updated Feb 2021) Preliminars for Ubuntu 20.04.1 LTS (with correct drivers for GPU)

    • Be a unix enthusiast. The GPU encoding pipelines in GStreamer are extremly powerful, but are hard to install.

    • Install GStreamer sudo apt-get install gstreamer1.0* libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev libgstreamer1.0 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev)

    • optional FFMPEG, QT (+ OpenGL)

    • recommended for Intel-CPUs (with Intel HD GPU) (> Gen7)

    • recommended for NVIDIA GPUs

      • CUDA > 10.1, CuDNN > 7.5
      • NVidia Video Codec SDK (check out this to enable CUDA acc. H264/H265 enc/dec)
    • recommended for AMD GPUs

      • get a NVIDIA GPU (or feel free to contribute method; please stop sending this
      • not sponsored by NVIDIA, but by them
    • Build & install OpenCV 4.x (4.2 works good for me)

      • Mind that CUDA requires opencv-contrib modules
      • enable deprecated PKG_CONFIG files. Idk why OpenCV thinks they aren't needed anymore.
      • highly recommend cmake-gui (sudo apt-get install cmake-qt-gui); search and click the features you want to have enabled
      • or enable gstreamer 1.0 support with -D WITH_GSTREAMER=ON

Tests

  • Test if GStreamer installation was successful: gst-launch-1.0 v4l2src ! xvimagesink. You should see your webcam's image.
  • Test if Intel MFX installation was successful: $ gst-inspect-1.0 | grep mfx mfx: mfxh264dec: MFX H264 decoder mfx: mfxhevcdec: MFX HEVC decoder mfx: mfxh264enc: MFX H.264 encoder mfx: mfxhevcenc: MFX H.265 encoder ...
  • Test if NVIDIA NVENC installation was successful: $ gst-inspect-1.0 | grep nvenc nvenc: nvh264enc: NVENC H.264 Video Encoder

Usage

Further informations

Inspired by https://github.com/tik0/mat2gstreamer

Disclaimer

  • Use at your own risk
  • It works on my machine

About

Python examples on how to use GStreamer within OpenCV. Now with GPU support! 🔥🔥🔥

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%
0