You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## I give you the light of ~~Eärendil~~ GStreamer, our most beloved ~~star~~ lib. May it be a light for you in dark places, when all other lights go out.
4
+
###I give you the light of ~~Eärendil~~ GStreamer, our most beloved ~~star~~ lib. May it be a light for you in dark places, when all other lights go out.
5
5
6
-
These examples, written in Python, will provide a good starting point for a lot, and the most common, applications of GStreamer and OpenCV. The snippets include following functionalities:
6
+
## Short intro
7
+
These examples, written in Python, will provide a good starting point for a lot, and the most common, applications of GStreamer and OpenCV. The snippets mainly use OpenCV's VideoWriter and VideoCapture object, and include the following functionalities:
As you are here, you probably know why you want to use GStreamer and OpenCV and I'm not gonna list all the advantages that GStreamer brings to the table.
51
-
**However, if you find this repo helpful or even remotely funny, consider leaving a star.** Or not. Your choice.
51
+
Since you are here, you probably know why you want to use GStreamer and OpenCV and I'm not gonna list all the advantages that GStreamer brings to the table. **However, if you find this repo helpful or even remotely funny, consider leaving a star.** Or not. Your choice.
- 2021-03-23 **Updated README; preparation for nvidia examples**
55
56
- 2021-03-01 **Updated for usage with Intel HD GPUs. NVIDIA examples as well as more complex stuff like splitting coming soon**
57
+
58
+
59
+
60
+
56
61
57
62
# Prerequisites
58
63
@@ -75,26 +80,41 @@ As you are here, you probably know why you want to use GStreamer and OpenCV and
75
80
- HW H264/H265 encoding and decoding
76
81
- Bitrate control (CBR, VBR, CQP).
77
82
- Selectable profiles up to High Profile.
78
-
- Installation process (quite tedious):
79
-
-
80
-
- Follow https://github.com/intel/gstreamer-media-SDK to install MSDK and gst-msdk
83
+
- Installation process (Honestly this is pretty frustrating Intel. I got very mad followed by getting drunk and yelling at the PC, but as far as i remember the process went something like this):
84
+
-[LibVA](https://github.com/intel/libva)
85
+
-[GmmLib](https://github.com/intel/gmmlib)
86
+
-[Intel(R) Media Driver for VAAPI](https://github.com/intel/media-driver)
87
+
-[Intel Media SDK](https://github.com/Intel-Media-SDK/MediaSDK#how-to-build)
- Further instructions are [here](https://blogs.igalia.com/vjaquez/2018/11/23/building-gst-msdk-with-mediasdk-opensource/), [here](https://github.com/Intel-Media-SDK/MediaSDK#how-to-build)
-_(not easy to setup, especially with parallel CUDA configuration; be warned)_
83
-
-_x264enc: 25 ms (Software) ; mfxh264enc: 1 ms (HW enc)_: Achieved speedup on 1920x1080 px
92
+
- Achieved speedup for writing a Full-HD frame (1920x1080px) to NVMe SSD:
93
+
-_x264enc (Software encoding)_: 25 ms
94
+
-_mfxh264enc (Hardware encoding)_: 1 ms
84
95
-_**NVIDIA GPUs**_
85
-
- CUDA > 10.1, CuDNN > 7.5
86
-
- CUDA accelerated H264/H265 encoding and decoding
87
-
- Nvidia Video Codec SDK (check out [this](https://gist.github.com/corenel/a615b6f7eb5b5425aa49343a7b409200) to enable CUDA acc. H264/H265 enc/dec)
88
-
-_Recommended for **AMD GPUs**_
96
+
- Supported platforms: CUDA enabled NVIDIA GPU ([List of CUDA GPUs](https://developer.nvidia.com/cuda-gpus)) (tested on GTX1070, GTX1080Ti and RTX 2070)
97
+
- Noticable features:
98
+
- HW H264/H265 encoding and decoding
99
+
- Bitrate control (CBR, VBR, CQP)
100
+
- Installation process (not so tedious, but still):
101
+
- Get your correct drivers, CUDA and preferably CUDNN ([Link](https://askubuntu.com/questions/1077061/how-do-i-install-nvidia-and-cuda-drivers-into-ubuntu))
102
+
- Follow [this](https://gist.github.com/corenel/a615b6f7eb5b5425aa49343a7b409200) guide (mind here to **checkout the correct branch for your GStreamer version**, for me it was 1.16.2 instead of 1.14.0) and **read the comments**.
103
+
- If you're having problems finding the plugins, check the installation paths of GStreamer plugins. It may be found in `/usr/lib/x86_64-linux-gnu/gstreamer-1.0/`, or in `/usr/local/lib/gstreamer-1.0/` or even in your local path if you don't have `sudo`. Truth is that i copipasta'd the files until it matched. There might be a more elegant way to do this.
104
+
105
+
-_**AMD GPUs**_
89
106
- get a NVIDIA GPU (or feel free to contribute method)
90
107
- not sponsored by NVIDIA, but by [them](https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstleyVEVO)
91
-
- Build & install **OpenCV 4.x** (4.2 works good for me)
- highly recommend **cmake-gui** (`sudo apt-get install cmake-qt-gui`); search and click the features you want to have enabled
108
+
109
+
# Building OpenCV
110
+
- Build & install **OpenCV 4.x** (4.2 works good for me; ROS works with it)
111
+
- Mind here that we need to change **a lot** of CMake flags, so I highly recommend **cmake-gui** (`sudo apt-get install cmake-qt-gui`); search and click the features you want to have enabled (even after your exec'd a usual `cmake -D` flag)
112
+
-[Guide](https://medium.com/@sb.jaduniv/how-to-install-opencv-4-2-0-with-cuda-10-1-on-ubuntu-20-04-lts-focal-fossa-bdc034109df3) for building with CUDA support on Ubuntu 20.04 ([18.04 here](https://gist.github.com/raulqf/f42c718a658cddc16f9df07ecc627be7))
113
+
- Mind that CUDA requires opencv-contrib modules (do not forget to check out the correct version here as well)
-[gst_device_to_shm](gst_device_to_shm.py) grabs the `VideoCapture(0)` and puts the raw image in a shared memory. Mind here to define your own webcam properties.
124
144
-[gst_shm_to_app](gst_shm_to_app.py) grabs the shared memory frame from [gst_device_to_shm](gst_device_to_shm.py) and pipes it to a VideoCapture.
@@ -127,12 +147,15 @@ nvenc: nvh264enc: NVENC H.264 Video Encoder
127
147
-[gst_intel_device_to_app_to_file](gst_intel_device_to_app_to_file.py) grabs the `v4l2src /dev/video0` (usually webcam) to OpenCV format and writes it as an h264 encoded file.
128
148
-[gst_intel_device_to_app_to_rtp](gst_intel_device_to_app_to_rtp.py) grabs the `v4l2src /dev/video0` (usually webcam) to OpenCV format and writes it as an h264 encoded rtp stream. Use the provided `*.sdp` files for VLC viewer.
129
149
-[gst_shm_to_rtp](gst_shm_to_rtp.py) grabs the shared memory frame from [gst_device_to_shm](gst_device_to_shm.py) ,encodes the frame and streams it to `rtp://localhost:5000`.
0 commit comments