# Multiple camera encode on jetson nano

**URL:** <https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735>\
**Category:** Jetson Nano\
**Tags:** mmapi, camera\
**Created:** [July 26, 2021, 2:07pm UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735 "2021-07-26T14:07:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bob7421](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bob7421](https://forums.developer.nvidia.com/u/bob7421)\
**Post date:** [July 26, 2021, 2:07pm UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/1 "2021-07-26T14:07:35Z")

</div>

hi guys,

i’m struggling with the encoder :

i try to encode multiple camera at the same time, but it does not seems to work well…

as far as i can see, it seems in the Example 15\_multivideo\_encode that you managed to encode multiple files by creating threads on the entire code to run the encoder. so i’ve got 2 questions for you :

1 - is that possible to encode 3 camera at the same time on the nano ?  
2 - is “threading the overall” the only solution ?

tks

i’ve made a class for the encoder. it works fine with v4l2 and i’m not intended to switch to gstreamer.

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [July 27, 2021, 12:57am UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/3 "2021-07-27T00:57:28Z")

</div>

Hi,  
It depends on resolution and frame rate. For 3 1080p30 sources, it should achieve the performance in hardware encoding. You have developed an application in  
[Encode frames using Nvenc v4l2 - #17 by bob7421](https://forums.developer.nvidia.com/t/encode-frames-using-nvenc-v4l2/183424/17)

For a quick check you can run multiple processes such as

```auto
$ _your_application_ -d /dev/video0 & _your_application_ -d /dev/video1 & _your_application_ -d /dev/video2 &

```

And check if it achieves target performance.

---

<div class="post-metadata">

**Author:** ![bob7421](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bob7421](https://forums.developer.nvidia.com/u/bob7421)\
**Post date:** [July 27, 2021, 6:52am UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/4 "2021-07-27T06:52:59Z")

</div>

Hi DaneLLL,

ok,

i made a mistake in my post : i try to encode 3 flux from 1 camera.

if you have read the post ( `https://forums.developer.nvidia.com/t/encode-frames-using-nvenc-v4l2/183424/17` ) , you know that the 3 flux came from 3 VIC instances. actually i can encode 1 flux.

i might not expect i’m out of the capacity but this is the **camera’s resolutions** :

- 720p @ 120FPS
- 1080p @ 62FPS ( 65 FPS )
- 1920x1200 @60FPS

\*the three resolutions works : the capture, color conversion and encoding is working well \*

and this is the 3 flux resolution i want to encode :

- original ( one of the 3 above)
- 720p
- 480p

the encoder should encode at 30-60 FPS as it is set in the params

i read the sample 15 on Jetson Linux API. it seems that you thread the entire system including resolutions and the create encoder function. i was expecting to open one time the encoder and create threads only when its really needed : when buffer is declared.

did i missed something ?

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [July 27, 2021, 10:29am UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/5 "2021-07-27T10:29:51Z")

</div>

Hi,  
Each resolution has to create one `NvVideoEncoder`. Looks like you want to encode one 170p120, one 1080p62, one 1920x1200p60, one 720p, one 480p, so you need to create 5 `NvVideoEncoder` classes.

This use-case is not verified on Jetson Nano and may not achieve target performance for all 5 encoding threads. Would need to give it a try.

---

<div class="post-metadata">

**Author:** ![bob7421](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bob7421](https://forums.developer.nvidia.com/u/bob7421)\
**Post date:** [July 27, 2021, 10:35am UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/6 "2021-07-27T10:35:15Z")

</div>

hi, thanks,

i will try.

but for your reference : i try to encode one resolution among 720p @ 120FPS , 1080p @ 62FPS, or 1920x1200 @60FPS and want 3 output from the encoder : (the original selected before encoding ( so the native from camera ) and 720p and 480p

---

<div class="post-metadata">

**Author:** ![bob7421](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bob7421](https://forums.developer.nvidia.com/u/bob7421)\
**Post date:** [July 27, 2021, 12:55pm UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/7 "2021-07-27T12:55:48Z")

</div>

hi again,

after many attempt here is the situation :

when i try to create an object “videoencoder” with different name ( of the object but also of the encoder) it always say (from the second one ) that the encoder is busy. this seems to happen when the Queuing is called…

so, for reference i created 2 objects from my encoder class. they both use 2 different resolutions. and they came from one camera.

in fact, its near the same than the frontend example except that their is one camera, ( so one input ), and 3 output from the VIC so 3 diferents data to encode.

---

<div class="post-metadata">

**Author:** ![bob7421](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bob7421](https://forums.developer.nvidia.com/u/bob7421)\
**Post date:** [July 27, 2021, 1:15pm UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/8 "2021-07-27T13:15:18Z")

</div>

> [@DaneLLL](#):
>
> For a quick check you can run multiple processes such as
> 
> ```auto
> $ _your_application_ -d /dev/video0 & _your_application_ -d /dev/video1 & _your_application_ -d /dev/video2 &
> 
> ```
> 
> And check if it achieves target performance.

i’ve also tested this and it works, but its on two differents camera and two context …

if i try to load the two cameras in the same program to encode one flux each, it goes wrong…

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [July 27, 2021, 3:25pm UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/9 "2021-07-27T15:25:42Z")

</div>

Hi,  
It is single v4l2 capture thread in `12_camera_v4l2_cuda`. You would need to refer to it and develop multiple v4l2 capture threads for your use-case.

And for multiple encoding threads, would need to refer to `15_multivideo_encode`.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 3, 2021, 6:43am UTC](https://forums.developer.nvidia.com/t/multiple-camera-encode-on-jetson-nano/184735/11 "2021-10-03T06:43:56Z")

</div>

Closed on October 3, 2021, 6:43am UTC

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