FFmpeg hardware acceleration on Raspberry PI

Cristian Gabor picture Cristian Gabor · Oct 21, 2016 · Viewed 7.1k times · Source

I am building a program that use ffmpeg to stream webcam content over internet. I would like to know if it is possible to use the GPU for the streaming part on the raspberry pi model 3. If yes, how could I implement this on ffmpeg?

Answer

llogan picture llogan · Oct 21, 2016

You'll need some additional configure options:

  • --enable-mmal – Enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL. For hardware decoding of H.264, VC-1, MPEG-2, MPEG-4. As a dependency you'll need the linux-raspberrypi-headers (Arch Linux) or linux-headers-*-raspi2 (Ubuntu) package which provides the required header file mmal.h.

  • --enable-omx-rpi – Enable OpenMAX IL code for Raspberry Pi. For hardware encoding of H.264 (encoder is named h264_omx) and MPEG-4 (mpeg4_omx). As a dependency you'll need the libomxil-bellagio (Arch Linux) or libomxil-bellagio-dev (Ubuntu) package which provides the required header file OMX_Core.h.

For Arch Linux users:

Copy the PKGBUILD file for the ffmpeg package (perhaps via the ABS if you prefer). Add the two new configure options shown above, and add the two mentioned packages to the depends line. Compile/install with the makepkg command.

Disclaimer: I don't have one of these devices to test any of this. Most of this info was acquired from the FFmpeg configure file.