If the article is an original article, please indicate the source of the original article when reprinting it.
The blog address of this article: https://hpzwl.blog.csdn.net/article/details/133022813
Rockchip Development Column
Previous article: " RK3568 Development Notes (10): Application Demo developed by transplanting the development board buildroot firmware, starting full-screen display "
Next article: Stay tuned...
Preface
The target development task also has a function, which is to play rtsp cameras. Of course, in order to better sit on this, we must support retrying after rtsp playback fails, such as retrying to open it once every 5 seconds, so as to ensure that it can be reopened after being connected to the Internet, and then achieve this function. .
Demo
Replenish
Thanks to the buildroot on the solution, ffmpeg4.1.3 has been ported.
Camera hardware connection
Compile ffmpeg4.1.3
During the program transplantation process, it was found that the default ffmpge was missing swscale.h , which was very difficult to handle:
I thought of a way to patch it, cross-compile ffmpeg4.1.3 and patch it again.
Step 1: Download and unzip
http://ffmpeg.org/releases/Unzip
:
Step 2: Configure configure
Introduce cross compiler
export PATH=$PATH:/home/yang/work/src/topeet-qt5.14.2/topeet-qt5.14.2-aarch64/host/bin
Adjust the configuration as follows:
./configure --prefix=/home/yang/work/src/topeet-qt5.14.2/topeet-qt5.14.2-aarch64/host/aarch64-buildroot-linux-gnu/sysroot --arch=aarch64 --target-os=linux --enable-cross-compile --cross-prefix=aarch64-buildroot-linux-gnu- --enable-shared
Step 3: Compile make
make -j4
Step 4: Install make install
make install
Step 5: Check the libswsale image scaling and transformation module:
But the compilation still doesn’t work:
I couldn't bear it anymore, so I re-extracted a complete set of dependencies directly for the Qt project:
note that the prefix address was modified:
./configure --prefix=/home/yang/work/src/ffmpeg-aarch64 --arch=aarch64 --target-os=linux --enable-cross-compile --cross-prefix=aarch64-buildroot-linux-gnu- --enable-shared
Go through it again and get it into the ffmpeg code alone:
Get it in the code module:
Add pri dependency:
Compile, this time no header file error occurred, but a new error occurred:
Compile and pass:
Compilation dependencies are resolved:
Step 6: Cover ffmpeg4.1.2 on the development board with ffmpeg
You have to overwrite the new library, otherwise the following will appear:
Because sftp restricts the /root directory, package it directly and manually copy and overwrite it on the development board:
Copy to development board:
In fact, there is no need for a header file here. If the target board does not compile, there is no need for a header file. Just decompress the lib directly, and then copy everything in the folder to /usr/lib, as shown below:
Then run:
Successfully, look at the interface:
Start testing soft decoding rtsp
Ffmpeg pulls rtsp software to decode h364 display (1080p)
Then start soft decoding rtsp playback:
Playing for 1 second increases by 1 second, getting slower and slower, then turns gray and starts again:
Check the CPU, decoding 1080p directly explodes the CPU:
This approach won't work.
Ffmpeg pulls rtsp software to decode h364 and displays 360p (640x360)
Switch to substream:
The delay is about 1s-1.5s
as follows:
Then I tested and opened two decoders, and the delay basically had no effect. Then I ran the application to decode and interact with data for 50ms. There were no problems, so I can just demonstrate this first.
summary
The goal has been basically achieved this time. At the same time, it has been measured that rk can use mpp to pull rtsp and decode h264 packets into rgba. Directly brushing the buffer layer is the lowest delay and the lowest cpu consumption. It can also be displayed to qt, which consumes a little more delay. , it should be 10~30ms longer. The actual result needs to be tested.
Previous article: " RK3568 Development Notes (10): Application Demo developed by transplanting the development board buildroot firmware, starting full-screen display "
Next article: Stay tuned...
If the article is an original article, please indicate the source of the original article when reprinting it.
The blog address of this article: https://hpzwl.blog.csdn.net/article/details/133022813