|
HVE
HVE Hardware Video Encoder library
|
This library wraps hardware video encoding and scaling in a simple interface. There are no performance loses (at the cost of library flexibility).
Currently it supports VAAPI and various codecs (H.264, HEVC, ...).\ VBR and CQP modes are supported (e.g. streaming and later editting).
See library documentation.
See also twin HVD Hardware Video Decoder library.
See hardware-video-streaming for other related projects.
Raw encoding (H264, HEVC, ...):
Complex pipelines (muxing, filtering) are beyond the scope of this library.
Unix-like operating systems (e.g. Linux). Tested on Ubuntu 18.04.
Intel VAAPI compatible hardware encoders (Quick Sync Video)
Library depends on:
avcodec, avutil, avfilter (at least 3.4 version)Works with system FFmpeg on Ubuntu 18.04 and doesn't on 16.04 (outdated FFmpeg and VAAPI ecosystem).
Tested on Ubuntu 18.04.
If you get errors see troubleshooting.
Play result raw H.264/HEVC file with FFmpeg:
You should see procedurally generated video (moving through greyscale).
See examples directory for more complete and commented examples with error handling.
There are just 4 functions and 3 user-visible data types:
hve_inithve_send_frame (sends uncompressed data to hardware)hve_receive_packet (retrieves compressed data from hardware)hve_closeThat's it! You have just seen all the functions and data types in the library.
You have several options.
For static linking of HVE and dynamic linking of FFmpeg libraries (easiest):
hve.h and hve.c to your project and add them in your favourite IDEavcodec, avutil, avfilter to linked libraries in IDE project configurationFor dynamic linking of HVE and FFmpeg libraries:
hve.h where compiler can find it (e.g. make install for /usr/local/include/hve.h)libhve.so where linker can find it (e.g. make install for /usr/local/lib/libhve.so)/usr/local/... is considered for librarieshve, avcodec, avutil, avfilter to linked libraries in IDE project configurationlibhve.so is reachable to you program at runtime (e.g. set LD_LIBRARIES_PATH)Assuming directory structure with HVE as hardware-video-encoder subdirectory (or git submodule) of your project.
You may use the following top level CMakeLists.txt
For example see realsense-ir-to-vaapi-h264
Assuming your main.c/main.cpp and hve.h, hve.c are all in the same directory:
C
C++
Library is licensed under Mozilla Public License, v. 2.0
This is similiar to LGPL but more permissive:
Like in LGPL, if you modify this library, you have to make your changes available. Making a github fork of the library with your changes satisfies those requirements perfectly.
Since you are linking to FFmpeg libraries consider also avcodec, avutil and avfilter licensing.
Realsense D400 camera infrared stream to H.264 - realsense-ir-to-vaapi-h264\ Realsense D400 camera depth stream to HEVC Main10 - realsense-depth-to-vaapi-hevc10