Jetson Orin Nano H264 Encoding Performance and Optimization
Issue Overview
Users are experiencing lower-than-expected H264 encoding performance on the Nvidia Jetson Orin Nano development board. The official blog post claims encoding speeds of up to 110 FPS using four CPU cores, but users are unable to achieve these results. The main symptoms include:
- Maximum encoding speed of about 17 FPS using all 6 CPU cores
- Difficulty reaching the claimed 110 FPS for 1080p H264 encoding
- Inconsistency between official performance claims and real-world results
The issue occurs during video encoding tasks using FFmpeg or GStreamer pipelines. It impacts the overall system performance and limits the board’s capabilities for video processing applications.
Possible Causes
-
Suboptimal encoding settings: The default encoding parameters may not be optimized for maximum performance on the Jetson Orin Nano.
-
Software version differences: The FFmpeg version used by users might differ from the one used in the official benchmarks.
-
Hardware utilization issues: The encoding process may not be fully utilizing the available hardware resources.
-
Input file format and resolution: The specific characteristics of the input video file could affect encoding performance.
-
System configuration: Suboptimal system settings or background processes could be impacting encoding performance.
-
Thermal throttling: High CPU usage during encoding might lead to thermal issues, causing performance degradation.
Troubleshooting Steps, Solutions & Fixes
-
Optimize encoding settings:
- Use the
ultrafast
preset for x264 encoding to prioritize speed over quality:gst-launch-1.0 multifilesrc location=h264_1080p.264 loop=1 ! h264parse ! nvv4l2decoder enable-max-performance=1 ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! 'video/x-raw' ! x264enc speed-preset="ultrafast" ! 'video/x-h264' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v
- Experiment with different
speed-preset
values to find the optimal balance between speed and quality for your application.
- Use the
-
Use hardware acceleration:
- Leverage the Jetson’s hardware encoder by using the
nvv4l2h264enc
element instead ofx264enc
:gst-launch-1.0 multifilesrc location=h264_1080p.264 loop=1 ! h264parse ! nvv4l2decoder enable-max-performance=1 ! 'video/x-raw(memory:NVMM)' ! nvv4l2h264enc ! 'video/x-h264' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v
- Leverage the Jetson’s hardware encoder by using the
-
Optimize system performance:
- Run
sudo jetson_clocks
before encoding to maximize system performance. - Monitor CPU usage and temperature using
sudo tegrastats
to ensure optimal performance and avoid thermal throttling.
- Run
-
Adjust encoding parameters:
- Experiment with different
x264enc
properties to optimize performance:- Set the encoding mode to CBR (Constant Bit Rate) for more consistent performance.
- Adjust the virtual buffer size to balance quality and performance.
- Experiment with different
-
Use the latest software versions:
- Ensure you’re using the latest JetPack and L4T (Linux for Tegra) versions for your Jetson Orin Nano.
- Update FFmpeg and GStreamer to the latest compatible versions.
-
Profile the encoding process:
- Use tools like
gst-instruments
orgst-debugger
to identify bottlenecks in the GStreamer pipeline. - Analyze CPU and GPU utilization during encoding to ensure resources are being used efficiently.
- Use tools like
-
Optimize input video:
- Ensure the input video format and resolution match the expected parameters (e.g., 1080p, 30 FPS).
- Pre-process the video if necessary to reduce the encoding workload.
-
Consider alternative encoders:
- Experiment with other hardware-accelerated encoders available on the Jetson platform, such as
omxh264enc
.
- Experiment with other hardware-accelerated encoders available on the Jetson platform, such as
-
Fine-tune x264enc settings:
- Adjust parameters like
tune
,threads
, andqp-min
/qp-max
to optimize the encoding process for your specific use case.
- Adjust parameters like
-
Monitor and log performance:
- Implement logging in your encoding pipeline to track FPS and other performance metrics over time.
- Use this data to identify patterns or issues affecting encoding performance.
By systematically applying these troubleshooting steps and optimizations, you should be able to improve the H264 encoding performance on your Jetson Orin Nano. Remember to balance encoding speed with the required video quality for your specific application.