Camnvenc is a qualification task for CCExtractor'21
(https://ccextractor.org/public/gsoc/takehome/#interprocess_communication_low-level).\
This project focuses on the problem of encoding stream of 10 or more cameras using NVDIA hardware. CUDA toolkit and FFMpeg is used to create 2 simultaneous encoding sessions of nvenc. Interprocess communication is also used to reduce load of memory copying.
This project consists of two programs, cammanager and gpumanager.
Gpumanager runs independent of cammanagers. It detects recently active cameras and recently closed/crashed cameras continuously. When a camera has 60 frames ready, it starts encoding. As it encodes first 60 frames of a camera, it sends that camera end of the queue and starts encoding next camera. This gpumanager can work with 1 to 10 or more cameras.
Cammanagers are individual processes that reads random data (for test case) and writes them into shared memory as it conducts a queue data structure. They can be activated or deactivated independent of any other process.
build-essentials (for make and gcc)
$ sudo apt-get install build-essential
pkg-config
$ sudo apt-get install pkg-config
libssl-dev
$ sudo apt-get install libssl-dev
libavformat-dev
$ sudo apt-get install libavformat-dev
CUDA Toolkit
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
$ git clone https://github.com/aliereny/camnvenc.git
$ make
This project is designed for Linux environment. To build
- Move to corresponding directory:
$ cd camnvenc
- Run makefile
$ make
- A gpumanager and different cameras should be run:
$ ./gpumanager
- Cameramanager's should be run on different terminals with following command:
$ ./cammanager /camera_<id>
id should be in range 0-10, for example:
$ ./cammanager /camera_0
or
$ ./cammanager /camera_1
- Automatic generated "log.txt" file can be used to see processes working correctly. log.txt file will look like:
camera=/camera_0 frame= 211 checksum=89364006428aed82b5389a57b7ccd2fe
camera=/camera_0 frame= 212 checksum=4426bb88fe5aef020d45f13f31c5b6f8
camera=/camera_0 frame= 213 checksum=53f5b169c938b506f54f8fc80d244646