# SVO to mp4 export speed up on Nvidia Jetsons

**URL:** <https://community.stereolabs.com/t/svo-to-mp4-export-speed-up-on-nvidia-jetsons/6242>\
**Category:** Software\
**Tags:** python, zed-sdk, jetpack, jetson\
**Created:** [June 5, 2024, 4:03pm UTC](https://community.stereolabs.com/t/svo-to-mp4-export-speed-up-on-nvidia-jetsons/6242 "2024-06-05T16:03:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![efan4ik](https://community.stereolabs.com/user_avatar/community.stereolabs.com/efan4ik/32/1543_2.png) [@efan4ik](https://community.stereolabs.com/u/efan4ik)\
**Post date:** [June 5, 2024, 4:03pm UTC](https://community.stereolabs.com/t/svo-to-mp4-export-speed-up-on-nvidia-jetsons/6242/1 "2024-06-05T16:03:23Z")

</div>

Hello

I am recording videos (lossy H265) on Jetson Orin NX 16GB

 ![image](https://community.stereolabs.com/uploads/default/original/2X/1/16fc804b2dede88d3112c820a5f94d4ba936841e.png)

using the following code  
[https://github.com/stereolabs/zed-sdk/blob/master/recording/recording/mono/python/svo\_recording.py](https://github.com/stereolabs/zed-sdk/blob/master/recording/recording/mono/python/svo_recording.py)

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

---

<div class="post-metadata">

**Author:** ![mattrouss](https://community.stereolabs.com/user_avatar/community.stereolabs.com/mattrouss/32/2452_2.png) [@mattrouss](https://community.stereolabs.com/u/mattrouss)\
**Post date:** [June 10, 2024, 4:37pm UTC](https://community.stereolabs.com/t/svo-to-mp4-export-speed-up-on-nvidia-jetsons/6242/2 "2024-06-10T16:37:04Z")

</div>

Hi @efan4ik,

Welcome to the [Stereolabs](https://www.stereolabs.com/) forums 🙂

If performance is what you are looking for, have you tried the export sample in C++ and noticed any differences for exporting the videos?

I am not familiar with ffmpeg options in general, but the workflow you are performing is correct, decoding the svo and re-encoding it again is the way to go.

---

<div class="post-metadata">

**Author:** ![efan4ik](https://community.stereolabs.com/user_avatar/community.stereolabs.com/efan4ik/32/1543_2.png) [@efan4ik](https://community.stereolabs.com/u/efan4ik)\
**Post date:** [August 9, 2024, 12:20pm UTC](https://community.stereolabs.com/t/svo-to-mp4-export-speed-up-on-nvidia-jetsons/6242/3 "2024-08-09T12:20:28Z")

</div>

This is the fastest way I found to do that on Jetson

gst\_out = f"appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! video/x-raw,format=BGRx ! nvvidconv ! nvv4l2h265enc ! h265parse ! matroskamux ! filesink location={mp4\_filename}"  
output\_deided\_mp4 = cv2.VideoWriter(gst\_out, cv2.CAP\_GSTREAMER, 0, float(svo\_fps), (int(rotated\_width), int(rotated\_height)))

The solution was found on Nvidia Developer Forum

> **[SVO to mp4 export speed up on Nvidia Jetsons](https://forums.developer.nvidia.com/t/svo-to-mp4-export-speed-up-on-nvidia-jetsons/295258)**
>
> 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)...

> **[Displaying to the screen with OpenCV and GStreamer](https://forums.developer.nvidia.com/t/displaying-to-the-screen-with-opencv-and-gstreamer/140648/8)**
>
> Hi, 1- How I can use HW accelerate for encoding using gstreamer + opencv in python for writing to file? 2- How I can use HW accelaretor for decoding unsing gstreamer + opencv in python with nvv4l2decoder? 3- All codes of decoding and encoding...
