low_delay_net_display例子默认只支持YUV420和RGB888,如果需要支持YUV422,请添加下面部分:
rk3588_nvr/build/app/low_delay_net_display$ git diff v4l2HdmiRX.cpp
diff --git a/app/low_delay_net_display/v4l2HdmiRX.cpp b/app/low_delay_net_display/v4l2HdmiRX.cpp
old mode 100644
new mode 100755
index 31a98ac..f49e001
--- a/app/low_delay_net_display/v4l2HdmiRX.cpp
+++ b/app/low_delay_net_display/v4l2HdmiRX.cpp
@@ -750,10 +750,33 @@ static int process_stream(struct rkcam_context *ctx) {
///enc/dec/RK_FMT_RGB888
if (ctx->enable_encode > 0) {
rt_atrace_begin_body("init_venc");
+
if (strstr(ctx->pixel_format, "NV12") > 0) {
init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV420SP, venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422SP") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422SP , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422P") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422P , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422SP_VU") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422SP_VU , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422_YUYV") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422_YUYV , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422_UYVY") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422_UYVY , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422_YVYU") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422_YVYU , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV422_VYUY") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV422_VYUY , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV444") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV444 , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV444SP") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV444SP , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV444SP_10BIT") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV444SP_10BIT , venc_callback);
+ } else if (strstr(ctx->pixel_format, "YUV444P") > 0) {
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_YUV444P, venc_callback);
} else {
- init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_RGB888, venc_callback);
+ init_venc(ctx->width,ctx->height, ctx->width, ctx->height, 0, ctx->max_bitrate, RK_FMT_BGR888, venc_callback);
}
std::thread t(thread_get_stream, 0);
t.detach();
与调试相关的命令:
//获取设备信息
v4l2-ctl -d /dev/video8 -V -D
//获取外部设备输入的分辨率信息
v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=10 --stream-poll --
//抓取帧率(需要设置好分辨率和像素格式)
v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=10 --stream-poll --
//把抓取到的帧保存为文件,这里表示抓一帧并保存在 data/4kp60_nv12.yuv
v4l2-ctl -d /dev/video8 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=10 --stream-to=/data/4kp60_nv12.yuv --stream-count=1 --stream-poll
//解码端运行
ifconfig eth0 192.168.5.11 netmask 255.255.255.0 up
/usr/bin/testHdmiRxDec -w 3840 -h 2160 -p NV12 --stream-mmap=3 --display-type=0 --display-w=3840 --display-h=2160 --enable-adjust-clk=1 &
//编码端运行
ifconfig eth0 192.168.5.12 netmask 255.255.255.0 up
/usr/bin/testHdmiRx -d /dev/video0 -w 3840 -h 2160 -p NV12 --stream-mmap=3 --enable-vo=1 --enable-encode=1 --display-type=0 --display-w=3840 --display-h=2160 &
1、不知道编译步骤,编译不过所做的修改可以编过:
--- a/app/RKMPI_Release/example/mod/CMakeLists.txt
+++ b/app/RKMPI_Release/example/mod/CMakeLists.txt
@@ -3,6 +3,32 @@ add_definitions(-fno-rtti)
add_compile_options(-std=c++11)
add_definitions(-std=c++11 -Wno-attributes -Wno-deprecated-declarations -DANDROID_STL=c++_shared)
+set(CMAKE_CXX_COMPILER /media/extern_sda/wzh/rk3588_nvr/build/toolchain/bin/aarch64-none-linux-gnu-g++)
+set(CMAKE_C_COMPILER /media/extern_sda/wzh/rk3588_nvr/build/toolchain/bin/aarch64-none-linux-gnu-gcc)
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/toolchain/aarch64-none-linux-gnu/libc/usr/include/drm/)
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/toolchain/aarch64-none-linux-gnu/libc/usr/include/)
+
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/include/)
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/example/include/)
+
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/include/)
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/include/)
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/app/low_delay_net_display/api/)
+include_directories(/media/extern_sda/wzh/rk3588_nvr/build/app/low_delay_net_display/tools/)
+
+
+set(RK_DEP_COMMON_LIBS
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib/libavcodec.so.58
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib/libavformat.so.58
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib/libavutil.so.56
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib/libswresample.so.3
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib//librockchip_mpp.so.1
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib/libdrm.so.2
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/deps/lib/libasound.so.2
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/sdk/lib64/librockit.so
+ /media/extern_sda/wzh/rk3588_nvr/build/app/RKMPI_Release/example/common/librt_test_comm.a
+ -lpthread
+)
set(RK_MPI_TEST_AO_SRC
test_mpi_ao.cpp
@@ -34,6 +60,12 @@ set(RK_MPI_TEST_SYS_SRC
)
set(RK_MPI_TEST_VDEC_SRC
+ ../../../low_delay_net_display/tools/Timers.cpp
+ ../../../low_delay_net_display/tools/rt_trace.cpp
+ ../../../low_delay_net_display/tools/trace.cpp
+ ../../../low_delay_net_display/tools/vbltest.cpp
+ ../../../low_delay_net_display/api/mpi_vo.cpp
+ ../../../low_delay_net_display/api/AdjustClkApi.cpp
test_mpi_vdec.cpp
)
2、正常的编译步骤
./build_emmc.sh env
cd build/app/build/app/
./build.sh ../low_delay_net_display