FFmpeg Support
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
The FFmpeg is an LVGL extension that interfaces with the official FFmpeg library to help you add platform-independent recording, converting and streaming audio and video into your LVGL UI.
The set-up steps below are for Linux, but they can be adapted for other platforms.
For a detailed introduction, see: https://www.ffmpeg.org
Installing FFmpeg
sudo apt install libavformat-dev libavcodec-dev libswscale-dev libavutil-devOr download the FFmpeg library from its official download page, then install it:
./configure --disable-all --disable-autodetect --disable-podpages --disable-asm --enable-avcodec --enable-avformat --enable-decoders --enable-encoders --enable-demuxers --enable-parsers --enable-protocol='file' --enable-swscale --enable-zlib
make
sudo make installAdding FFmpeg to Your Project
To use the FFmpeg library in your project, you will need to link against these
libraries:
| Field | Description |
|---|---|
libavformat | part of FFmpeg library |
libavcodec | part of FFmpeg library |
libavutil | part of FFmpeg library |
libswscale | part of FFmpeg library |
:libm: :libz: :libpthread:
If you are using GCC-based toolchain, this can be taken care of by adding the following command-line options:
-lavformat -lavcodec -lavutil -lswscale -lm -lz -lpthreadUsage
Set the LV_USE_FFMPEG in lv_conf.h to 1.
Also set LV_FFMPEG_PLAYER_USE_LV_FS in lv_conf.h to 1 if you want
to integrate the LVGL File System (lv_fs_drv) extension into FFmpeg.
This library can load videos and images. The LVGL file system
will always be used when an image is loaded with lv_image_set_src
regardless of the value of LV_FFMPEG_PLAYER_USE_LV_FS.
The ffmpeg player uses software decoding by default. If you require a hardware decoder, you must manually specify it using lv_ffmpeg_player_set_decoder, such as h264_v4l2m2m.
See the examples below for how to correctly use this library.
Events
LV_EVENT_READYSent when playback is complete and auto-restart is not enabled.
Learn more about events.
Examples
Decode image
Decode video
API
How is this guide?
Last updated on