SVO to mp4 export speed up on Nvidia Jetsons

Hello

I use ZED 2 camera for recording videos (lossy H265) on Jetson Orin NX 16GB

using the following code

After that I need to perform extraction to an .avi or .mp4 file while applying rotation and blurring of the faces (anonymization) using built-in body tracking (head position). Unfortunately on Jetson Orin NX it takes enormous amount of time (up to x10-15 of the original video duration).

Based on a basic profiling most of the time takes actual encoding. In the official ZED SDK sample cv2.VideoWriter_fourcc is used. I tried to use ffmpeg and Python pipes to speed up the process but it didn’t end with any significant performance boost.

What are the most optimal params for ffmpeg to use Jetson hardware acceleration for video extraction from .svo files ? Is there an alternative way of doing that ?

works but runs entirely on CPU which is very slow

ffmpeg_process = sp.Popen(shlex.split(
    f'ffmpeg -y -s {rotated_width}x{rotated_height} -pixel_format bgr24 -f rawvideo -r {svo_fps} -i pipe: -vcodec libx265 -pix_fmt yuv420p -crf 26 {deided_mp4_filename}'),
    stdin=sp.PIPE)

doesn’t work

# ffmpeg_process = sp.Popen(shlex.split(
#     f'ffmpeg -hwaccel cuda -y -s {rotated_width}x{rotated_height} -pixel_format bgr24 -f rawvideo -r {svo_fps} -i pipe: -vcodec hevc_nvenc -pix_fmt yuv420p -crf 26 {deided_mp4_filename}'),
#     stdin=sp.PIPE)

Thank you

Hi,
Looks like it uses software encoding in the sample. You may try to integrate hardware encoding with it. We support hardware encoding in gstreamer and jetson_multimedia_api. Please check

Multimedia — NVIDIA Jetson Linux Developer Guide 1 documentation
Jetson Linux API Reference: Main Page | NVIDIA Docs

If you would like to use OpenCV, may try this:
Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.