Keylost / jetson-ffmpeg

ffmpeg support on nvidia jetson
Other
76 stars 26 forks source link

Doesn't compile under Ubuntu 22.04 Tegra TX1. #21

Closed mrcmunir closed 10 months ago

mrcmunir commented 10 months ago
git clone https://github.com/Keylost/jetson-ffmpeg.git
cd jetson-ffmpeg
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig
Cloning into 'jetson-ffmpeg'...
remote: Enumerating objects: 520, done.
remote: Counting objects: 100% (520/520), done.
remote: Compressing objects: 100% (224/224), done.
remote: Total 520 (delta 305), reused 471 (delta 282), pack-reused 0
Receiving objects: 100% (520/520), 299.37 KiB | 2.93 MiB/s, done.
Resolving deltas: 100% (305/305), done.
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aresuser/jetson-ffmpeg/build
[  4%] Building CXX object CMakeFiles/nvmpi.dir/src/nvmpi_dec.cpp.o
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:287: warning: "V4L2_H264_DPB_ENTRY_FLAG_ACTIVE" redefined
  287 | #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE     0x01
      | 
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1521: note: this is the location of the previous definition
 1521 | #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE         0x02
      | 
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:288: warning: "V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM" redefined
  288 | #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM  0x02
      | 
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1522: note: this is the location of the previous definition
 1522 | #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM      0x04
      | 
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:178:8: error: redefinition of ‘struct v4l2_ctrl_h264_sps’
  178 | struct v4l2_ctrl_h264_sps {
      |        ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1306:8: note: previous definition of ‘struct v4l2_ctrl_h264_sps’
 1306 | struct v4l2_ctrl_h264_sps {
      |        ^~~~~~~~~~~~~~~~~~
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:207:8: error: redefinition of ‘struct v4l2_ctrl_h264_pps’
  207 | struct v4l2_ctrl_h264_pps {
      |        ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1362:8: note: previous definition of ‘struct v4l2_ctrl_h264_pps’
 1362 | struct v4l2_ctrl_h264_pps {
      |        ^~~~~~~~~~~~~~~~~~
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:221:8: error: redefinition of ‘struct v4l2_ctrl_h264_scaling_matrix’
  221 | struct v4l2_ctrl_h264_scaling_matrix {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1394:8: note: previous definition of ‘struct v4l2_ctrl_h264_scaling_matrix’
 1394 | struct v4l2_ctrl_h264_scaling_matrix {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:226:8: error: redefinition of ‘struct v4l2_h264_weight_factors’
  226 | struct v4l2_h264_weight_factors {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1399:8: note: previous definition of ‘struct v4l2_h264_weight_factors’
 1399 | struct v4l2_h264_weight_factors {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/jetson_multimedia_api/include/NvBuffer.h:43,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/src/jetson_multimedia_api/include/v4l2_nv_extensions.h:289:8: error: redefinition of ‘struct v4l2_h264_dpb_entry’
  289 | struct v4l2_h264_dpb_entry {
      |        ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from /usr/src/jetson_multimedia_api/include/NvBuffer.h:39,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2ElementPlane.h:53,
                 from /usr/src/jetson_multimedia_api/include/NvV4l2Element.h:50,
                 from /usr/src/jetson_multimedia_api/include/NvVideoDecoder.h:48,
                 from /home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:2:
/usr/include/linux/v4l2-controls.h:1542:8: note: previous definition of ‘struct v4l2_h264_dpb_entry’
 1542 | struct v4l2_h264_dpb_entry {
      |        ^~~~~~~~~~~~~~~~~~~
/home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp: In function ‘int nvmpi_decoder_get_frame(nvmpictx*, nvFrame*, bool)’:
/home/aresuser/jetson-ffmpeg/src/nvmpi_dec.cpp:692:63: warning: unused parameter ‘wait’ [-Wunused-parameter]
  692 | int nvmpi_decoder_get_frame(nvmpictx* ctx,nvFrame* frame,bool wait)
      |                                                          ~~~~~^~~~
make[2]: *** [CMakeFiles/nvmpi.dir/build.make:76: CMakeFiles/nvmpi.dir/src/nvmpi_dec.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/nvmpi.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Seems doesn't compile due jetson multimedia api under TX1 cause conflict with v4l2 defines in /usr/include/linux/v4l2-control.h

Any solution or alternative to fix it?.

mrcmunir commented 10 months ago

Seems linux-libc-dev jammy update to recent kernel 5.15 headers breaking compatibility old jetson multimedia api structure . Downgrade to https://launchpad.net/ubuntu/focal/arm64/linux-libc-dev/5.4.0-169.187 Compile fine I think in some parte 5.11.xx header breaking due added these definition into the ibc6.