Streaming on board

We are going to install FFmpeg with hardware encoding capabilities. For this we will install the graphics card driver:

sudo apt-get install vainfo

Next, will checkout the FFmpeg repository:

git clone git@github.com:FFmpeg/FFmpeg.git

Now we will configure and compile it with vaapi support. We will install it in /opt/ffmpeg so that it doesn't eventually conflict with the Ubuntu ffmpeg package:

PKG_CONFIG_PATH="/opt/ffmpeg/lib/pkgconfig" ./configure --enable-shared --prefix=/opt/ffmpeg --enable-vaapi --enable-gpl
PATH="/opt/ffmpeg/:$PATH" make -j$(nproc) 
sudo make install

Update the LD_LIBRARY_PATH before compiling nimbro_cam_transport so that it finds the libraries. Add it to your .bashrc file:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ffmpeg/lib

Testing the vaapi encoding

Run the node of your realsense camera and the camera encoder:

roslaunch realsense2_camera rs_camera.launch
roscd nimbro_cam_transport
cd launch
roslaunch vaapisender.launch

You can monitor the actual usage of the graphics card by running sudo intel-gpu-top :

~$ intel-gpu-top 
  - ----/ 107 MHz;   87% RC6; ----- (null);      244 irqs/s

      IMC reads:   ------ (null)/s
     IMC writes:   ------ (null)/s

          ENGINE      BUSY                                                                                                                                                                                                                                                MI_SEMA MI_WAIT
     Render/3D/0    5.32% |████████████▌                                                                                                                                                                                                                                |      0%      0%
       Blitter/0    0.00% |                                                                                                                                                                                                                                             |      0%      0%
         Video/0    4.21% |█████████▉                                                                                                                                                                                                                                   |      0%      0%
  VideoEnhance/0    0.00% | 

Last updated