Conversation
…mpression Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
and small updates of pre-commit Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
…mpression related cases Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
…cation from pre-commit Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
ktro2828
left a comment
There was a problem hiding this comment.
Thank you for your dedicated PR! My first review's done. Please take a look when you have time!
...ated_image_processor_compression/include/accelerated_image_processor_compression/builder.hpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson_h264.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson_h265.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson_av1.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson.hpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive video encoder support for H.264, H.265, and AV1 codecs on NVIDIA Jetson Orin platforms. The implementation leverages hardware-accelerated encoding via the Jetson Multimedia API (NvVideoEncoder) and integrates with the existing ROS 2 node infrastructure to publish encoded video frames using the ffmpeg_image_transport_msgs::msg::FFMPEGPacket message type instead of sensor_msgs::msg::CompressedImage.
Changes:
- Added new video encoder classes (
JetsonH264Compressor,JetsonH265Compressor,JetsonAV1Compressor) with a common base class hierarchy - Extended ROS node to dynamically select between JPEG compression (using
CompressedImage) and video encoding (usingFFMPEGPacket) based on configuration - Added comprehensive test suites for all three video codecs with various parameter combinations
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
src/accelerated_image_processor_compression/include/accelerated_image_processor_compression/video_compressor.hpp |
Defines base VideoCompressor class and factory functions for codec-specific compressors |
src/accelerated_image_processor_compression/src/video_compressor/jetson.hpp |
Declares JetsonVideoCompressor base class with encoder parameters and virtual interface methods |
src/accelerated_image_processor_compression/src/video_compressor/jetson.cpp |
Implements core Jetson video encoder logic including initialization, processing, and callback handling |
src/accelerated_image_processor_compression/src/video_compressor/jetson_h264.cpp |
Implements H.264-specific encoder configuration and parameters |
src/accelerated_image_processor_compression/src/video_compressor/jetson_h265.cpp |
Implements H.265-specific encoder configuration and parameters |
src/accelerated_image_processor_compression/src/video_compressor/jetson_av1.cpp |
Implements AV1-specific encoder with IVF header stripping logic |
src/accelerated_image_processor_compression/src/video_compressor/jetson_error_helper.hpp |
Provides error handling macros and status types for encoder operations |
src/accelerated_image_processor_compression/src/video_compressor/jetson_precise_timestamp_map.hpp |
Implements thread-safe timestamp mapping to preserve nanosecond precision |
src/accelerated_image_processor_compression/src/builder.cpp |
Updates factory to support H264, H265, and AV1 compression types |
src/accelerated_image_processor_ros/src/imgproc_node.hpp |
Changes publisher types to PublisherBase for polymorphic message publishing |
src/accelerated_image_processor_ros/src/imgproc_node.cpp |
Implements dynamic publisher creation based on compression type (JPEG vs video) |
src/accelerated_image_processor_ros/src/conversion.cpp |
Adds to_ros_ffmpeg() and to_ros_ffmpeg_encoding() conversion functions |
src/accelerated_image_processor_common/include/accelerated_image_processor_common/datatype.hpp |
Adds video format enums and optional fields for PTS, flags, and endianness |
src/accelerated_image_processor_common/include/accelerated_image_processor_common/processor.hpp |
Makes process() virtual and extracts post_process() for video encoder callback use |
src/accelerated_image_processor_compression/test/jetson_video_compressor_*.cpp |
Comprehensive test suites for H264, H265, and AV1 encoders with parameter combinations |
src/accelerated_image_processor_compression/CMakeLists.txt |
Adds video encoder source files and VPI/NVMMAPI dependencies |
src/accelerated_image_processor_compression/cmake/FindNVMMAPI.cmake |
CMake module to locate Jetson Multimedia API libraries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/accelerated_image_processor_compression/test/jetson_video_compressor_av1.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson_av1.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson.hpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/test/jetson_video_compressor_h264.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/test/jetson_video_compressor_h265.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson_av1.cpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson.hpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Manato HIRABAYASHI <[email protected]>
Besides, since `create_compressor`s for video compression are only defined on the Jetson platform, `#ifdef` condition was added to skip the tests for video compressor creation on non-Jetson platforms. Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
Signed-off-by: Manato HIRABAYASHI <[email protected]>
src/accelerated_image_processor_common/include/accelerated_image_processor_common/datatype.hpp
Outdated
Show resolved
Hide resolved
src/accelerated_image_processor_compression/src/video_compressor/jetson_error_helper.hpp
Show resolved
Hide resolved
...e_processor_compression/include/accelerated_image_processor_compression/video_compressor.hpp
Outdated
Show resolved
Hide resolved
|
@manato One concern; It seems the unit-testing for |
Thanks to the review [comment](#29 (comment)), I noticed that `is_bigendian` is a common field in both sensor_msgs::msg::Image and ffmpeg_image_transport_msgs::msg::FFMPEGPacket. From this perspective, I conclude that `is_bigendian` can be a non-optional field in `common::ImageFormat` as well. Signed-off-by: Manato HIRABAYASHI <[email protected]>
Now, `JPEGCompressor` and `VideoCompressor` inherit the class Signed-off-by: Manato HIRABAYASHI <[email protected]>
@ktro2828 Thanks for your detailed confirmation. Over an hour sounds like a little bit too long to me. Because the test of On my environment, if I added the options: $ colcon test --executor sequential --ctest-args -j16 --event-handlers console_cohesion+ --packages-select accelerated_image_processor_compression
Starting >>> accelerated_image_processor_compression
# long log here...
100% tests passed, 0 tests failed out of 247
Label Time Summary:
gtest = 2.19 sec*proc (4 tests)
Total Test time (real) = 37.78 sec
---
Finished <<< accelerated_image_processor_compression [38.1s]
Summary: 1 package finished [38.5s]-> the test finished approximately 38 seconds. Even if I omit the options: $ colcon test --event-handlers console_cohesion+ --packages-select accelerated_image_processor_compression
Starting >>> accelerated_image_processor_compression
# long log here...
100% tests passed, 0 tests failed out of 247
Label Time Summary:
gtest = 1.94 sec*proc (4 tests)
Total Test time (real) = 445.88 sec
---
Finished <<< accelerated_image_processor_compression [7min 26s]
Summary: 1 package finished [7min 27s]-> It took approximately 7.5 minutes. Judging from your observation, I guess there are two possible causes:
For the 1. case, you can confirm whether the Jetson is max performance mode by the following ways: $ sudo jetson_clocks --show
SOC family:tegra234 Machine:CTI Forge + Orin AGX
Online CPUs: 0-11
cpu0: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu1: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu2: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu3: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu4: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu5: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu6: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu7: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu8: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu9: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu10: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu11: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
GPU MinFreq=1300500000 MaxFreq=1300500000 CurrentFreq=1300500000
EMC MinFreq=204000000 MaxFreq=3199000000 CurrentFreq=3199000000 FreqOverride=1
DLA0_CORE: Online=1 MinFreq=0 MaxFreq=1600000000 CurrentFreq=1600000000
DLA0_FALCON: Online=1 MinFreq=0 MaxFreq=844800000 CurrentFreq=844800000
DLA1_CORE: Online=1 MinFreq=0 MaxFreq=1600000000 CurrentFreq=1600000000
DLA1_FALCON: Online=1 MinFreq=0 MaxFreq=844800000 CurrentFreq=844800000
PVA0_VPS0: Online=1 MinFreq=0 MaxFreq=1152000000 CurrentFreq=1152000000
PVA0_AXI: Online=1 MinFreq=0 MaxFreq=832000000 CurrentFreq=832000000
FAN Dynamic Speed control=active hwmon4_pwm1=1
NV Power Mode: MAXNLike the above, all 12 CPU cores are online, MinFreq==MaxFreq==CurrentFreq, NV Power Mode==MAXN, if the Jetson Orin is in max performance mode. $sudo nvpmodel -m 0 # Set NV Power Mode to MAXN. system reboot will be required
$sudo jetson_clocks # Maximize online core frequencies. If it is not registered as systemd service, this needs to be executed at every bootFor the 2. case, the actual executables for the test exist under build/accelerated_image_processor_compression/jetson_video_compressor_av1.cpp_accelerated_image_processor_compressionWould you mind checking these two points? |
|
@manato Thank you for detailed supports!
Yeah, my device was in the power-saving mode, so I updated to max power mode Result of jetson_clocks --show$ sudo jetson_clocks --show
[sudo] password for nvidia:
SOC family:tegra234 Machine:CTI Forge + Orin AGX
Online CPUs: 0-11
cpu0: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu1: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu2: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu3: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu4: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu5: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu6: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu7: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu8: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu9: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu10: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
cpu11: Online=1 Governor=schedutil MinFreq=2201600 MaxFreq=2201600 CurrentFreq=2201600 IdleStates: WFI=0 c7=0
GPU MinFreq=1300500000 MaxFreq=1300500000 CurrentFreq=1300500000
Active GPU TPCs: 8
EMC MinFreq=204000000 MaxFreq=3199000000 CurrentFreq=3199000000 FreqOverride=1
DLA0_CORE: Online=1 MinFreq=0 MaxFreq=1600000000 CurrentFreq=1600000000
DLA0_FALCON: Online=1 MinFreq=0 MaxFreq=844800000 CurrentFreq=844800000
DLA1_CORE: Online=1 MinFreq=0 MaxFreq=1600000000 CurrentFreq=1600000000
DLA1_FALCON: Online=1 MinFreq=0 MaxFreq=844800000 CurrentFreq=844800000
PVA0_VPS0: Online=1 MinFreq=0 MaxFreq=1369600000 CurrentFreq=1369600000
PVA0_AXI: Online=1 MinFreq=0 MaxFreq=985600000 CurrentFreq=985600000
FAN Dynamic Speed Control=nvfancontrol hwmon0_pwm1=1
NV Power Mode: MAXN
Seems unit-testings for
Result of AV1 test$ build/accelerated_image_processor_compression/jetson_video_compressor_av1.cpp_accelerated_image_processor_compression
[==========] Running 41 tests from 3 test suites.
[----------] Global test environment set-up.
[----------] 1 test from TestAV1Compressor
[ RUN ] TestAV1Compressor.JetsonVideoCompressorAV1Default
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 282
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 282
808539713
875711822
808539713
875711822
NVMEDIA: Need to set EMC bandwidth : 282000
NvVideo: bBlitMode is set to TRUE
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp:933) <encoder> Capture Plane:Timed out waiting for dqthread
[ OK ] TestAV1Compressor.JetsonVideoCompressorAV1Default (1311 ms)
[----------] 1 test from TestAV1Compressor (1311 ms total)
...
...
...
[ RUN ] JetsonVideoCompressorAV1ComboWithoutTiling/TestAV1Compressor.JetsonVideoCompressorAV1ProfileLevelTypeCombo/7
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 282
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 282
NVMEDIA: Need to set EMC bandwidth : 282000
NvVideo: bBlitMode is set to TRUE
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp:933) <encoder> Capture Plane:Timed out waiting for dqthread
[ OK ] JetsonVideoCompressorAV1ComboWithoutTiling/TestAV1Compressor.JetsonVideoCompressorAV1ProfileLevelTypeCombo/7 (1225 ms)
[----------] 8 tests from JetsonVideoCompressorAV1ComboWithoutTiling/TestAV1Compressor (9760 ms total)
[----------] Global test environment tear-down
[==========] 41 tests from 3 test suites ran. (50046 ms total)
[ PASSED ] 41 tests.
nvidia@ANVIL:~/workspace/a
Result of H264 test$ build/accelerated_image_processor_compression/jetson_video_compressor_h264.cpp_accelerated_image_processor_compression
[==========] Running 97 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 1 test from TestH264Compressor
[ RUN ] TestH264Compressor.JetsonVideoCompressorH264Default
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
875711822
875967048
875711822
H264: extProfile = 5 Level = 51
NVMEDIA: Need to set EMC bandwidth : 282000
NvVideo: bBlitMode is set to TRUE
VENC: NvVideoEncBlockReportError: 2469: BlockSide error 0x4
NvVideoEnc: BlockError
NvVideoEncTransferOutputBufferToBlock: DoWork failed line# 680
NvVideoEnc: NvVideoEncTransferOutputBufferToBlock TransferBufferToBlock failed Line=691
...
...Stacked here
...
^C
Result of H265 test$ build/accelerated_image_processor_compression/jetson_video_compressor_h265.cpp_accelerated_image_processor_compression
[==========] Running 105 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 1 test from TestH265Compressor
[ RUN ] TestH265Compressor.JetsonVideoCompressorH265Default
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 8
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 8
892744264
875711822
892744264
875711822
NvVideo: H265 : Profile : 1
NVMEDIA: Need to set EMC bandwidth : 282000
NvVideo: bBlitMode is set to TRUE
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
NVENC_H265: Unsupported frameRate (Supported: 1.0 - 60.0), setting to deault value 30.00
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp:933) <encoder> Capture Plane:Timed out waiting for dqthread
[ OK ] TestH265Compressor.JetsonVideoCompressorH265Default (1297 ms)
[----------] 1 test from TestH265Compressor (1297 ms total)
...
...
...
[ RUN ] JetsonVideoCompressorH265Combo/TestH265Compressor.JetsonVideoCompressorH265ProfileLevelTypeCombo/68
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 8
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 8
892744264
875711822
892744264
875711822
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.cpp:169) <Buffer> Could not map buffer 3, plane 0
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp:733) <encoder> Capture Plane:Error during setup
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
/home/nvidia/workspace/accelerated_image_processor/src/accelerated_image_processor_compression/src/video_compressor/jetson.cpp:177 (Success)
Encoder initialization failed:
NvMMLiteOpen : Block : BlockType = 8
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 8
892744264
875711822
892744264
875711822
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
NVMAP_IOC_GET_FD failed: Bad address
NVMAP_IOC_GET_FD failed: Bad address
PosixMemMap:74 FD from Handle failed : Bad address
nvbufsurface: NvBufSurfaceMap function failed....
nvbufsurface: mapping of buffer (0) failed
nvbufsurface: error in mapping
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.cpp:169) <Buffer> Could not map buffer 0, plane 0
[ERROR] (/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp:733) <encoder> Capture Plane:Error during setup
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
nvbuf_utils: dmabuf_fd -24 mapped entry NOT found
/home/nvidia/workspace/accelerated_image_processor/src/accelerated_image_processor_compression/src/video_compressor/jetson.cpp:177 (Success)
Encoder initialization failed:
NvMMLiteOpen : Block : BlockType = 8
===== NvVideo: NVENC =====
InitNVENC: Host1x handle open failed
NvMMLiteBlockCreate : Block : BlockType = 8
Segmentation fault (core dumped)I will investigate what's the problem. Similar issue?: https://forums.developer.nvidia.com/t/maximum-width-and-height-supported-by-hardware-encoder/298688 |
| * @brief Execute post process | ||
| * @param processed The image to be post-processed | ||
| */ | ||
| void post_process(Image & processed) |
There was a problem hiding this comment.
[NIT] Seems better to rename as postprocess(...) for the name consistency with register_postprocess(...), what do you think?
PR Type
Related Links
Description
This pull request introduces the video encoder support running on the Jetson Orin platform.
Due to the hardware support constraint, the supported codecs are limited to
H.264,H.265, andAV1.The key changes are:
JetsonH264Compressor,JetsonH265Compressor, andJetsonAV1Compressorin theaccelerated_image_processor_compressionpackage. [1], [2], [3]. The overall relationship between those classes is as follows:Previous version (click to expand)
classDiagram class BaseProcessor class VideoCompressor class JetsonVideoCompressor namespace Dedicated_Encoders { class JetsonH264Compressor class JetsonH265Compressor class JetsonAV1Compressor } BaseProcessor : +process(image) BaseProcessor : +is_ready() VideoCompressor : +backend() JetsonVideoCompressor : +collect_codec_params_impl() JetsonVideoCompressor : +set_capture_plane_format_impl() JetsonVideoCompressor : +init_codec_impl() JetsonVideoCompressor : +payload_preprocess_impl() JetsonVideoCompressor : +payload_copy_impl() BaseProcessor <|-- VideoCompressor VideoCompressor <|-- JetsonVideoCompressor JetsonVideoCompressor <|-- JetsonH264Compressor JetsonVideoCompressor <|-- JetsonH265Compressor JetsonVideoCompressor <|-- JetsonAV1Compressor note for JetsonVideoCompressor "Each Jetson[*]Compressor implements its own *_impl methods"classDiagram class BaseProcessor class Compressor class VideoCompressor class JetsonVideoCompressor namespace Dedicated_Encoders { class JetsonH264Compressor class JetsonH265Compressor class JetsonAV1Compressor } BaseProcessor : +process(image) BaseProcessor : +is_ready() Compressor: +backend() JetsonVideoCompressor : +collect_codec_params_impl() JetsonVideoCompressor : +set_capture_plane_format_impl() JetsonVideoCompressor : +init_codec_impl() JetsonVideoCompressor : +payload_preprocess_impl() JetsonVideoCompressor : +payload_copy_impl() BaseProcessor <|-- Compressor Compressor <|-- JPEGCompressor Compressor <|-- VideoCompressor VideoCompressor <|-- JetsonVideoCompressor JetsonVideoCompressor <|-- JetsonH264Compressor JetsonVideoCompressor <|-- JetsonH265Compressor JetsonVideoCompressor <|-- JetsonAV1CompressorReview Procedure
Build package
Configure the
accelerated_image_processor_ros/config/imgproc.param.yamlto use video compression. For example, the configuration for publishing AV1 looks like:Launch the node
[optional] Encoded data can be briefly decoded by
ros2 run image_transport republish ffmpeg raw --ros-args \ -r /in/ffmpeg:=/image_raw/compressed \ -r out:=/image_raw/decompressed \ -r __node:=dec[Decoder]: cannot find pts that matches -1might be shown. This is possibly due to inappropriateptsfield handling, which lacks taking into account in the implementation at this moment.The followings are the results of
colcon testforaccelerated_image_processor_compressionandaccelerated_image_processor_ros, respectively.colcon test for `accelerated_image_processor_ros`
colcon test result for `accelerated_image_processor_compression` (partially clipped because the full log is too long)
Remarks
I decided to use
ffmpeg_image_transport_msgs::msg::FFMPEGPacketinstead ofsensor_msgs::msg::CompressedImagefor the video encoded data becausesensor_msgs::msg::CompressedImageis hard to express some information, such as the flag to show whether this is a key frame or not, which is mandatory for decoding.Pre-Review Checklist for the PR Author
PR Author should check the checkboxes below when creating the PR.
Checklist for the PR Reviewer
Reviewers should check the checkboxes below before approval.
Post-Review Checklist for the PR Author
PR Author should check the checkboxes below before merging.
CI Checks