# Decoding Issuse in TX2

**URL:** <https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435>\
**Category:** Jetson TX2\
**Tags:** decoder\
**Created:** [March 9, 2023, 1:28am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435 "2023-03-09T01:28:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjnhb20011](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mjnhb20011](https://forums.developer.nvidia.com/u/mjnhb20011)\
**Post date:** [March 9, 2023, 1:28am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/1 "2023-03-09T01:28:37Z")

</div>

Hi, I have issue with decoding h.264 stream in Jetson TX2 in L4T 32.6.1, Jetpack

I have 2 cameras with diffrent manufacture, and I modified 00\_video\_decode code and applied to my application to decode stream.

When I decode h.265 stream I can receive frame normally.

But, when I decode h.264 stream, from one camera give frame in same interval but the other one gives strange interval. (for example, normal one is decode frame every 200ms, strange interval is like 800ms, 2ms, 2ms, 100ms, 100ms I decode 5 frame in every channel)

I saw this issue ([TX2 H264 decode query - #2 by DaneLLL](https://forums.developer.nvidia.com/t/tx2-h264-decode-query/70700/2)) and used disableDPB() to end of my code.

Then, I can receive frame normally from both cameras.

My question is,

1. Is there any Issue with DPB (by codec or manufacture) ?
2. do I need to set profile when I make NvVideoDecoder to prevent strange frame interval?

---

<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:** [March 9, 2023, 4:22am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/3 "2023-03-09T04:22:41Z")

</div>

Hi,  
_disableDPB()_ can reduce latency in decoding but certain streams(certain streams which have B frames) cannot be correctly decoded. If your input stream can be correctly decoded, please call it to have less latency.

---

<div class="post-metadata">

**Author:** ![mjnhb20011](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mjnhb20011](https://forums.developer.nvidia.com/u/mjnhb20011)\
**Post date:** [March 9, 2023, 6:43am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/4 "2023-03-09T06:43:48Z")

</div>

Hi, DaneDLL. Thanks for your reply.

I understand that disableDPB is reduce decoding latency.

But my Issue was  
2 different manufacture cameras with same codec(h.264), same environmnet

time it takes to decode from one camera is constant. but the other camera is not constant (some frames is take too long like 800ms, some frames take very short time like 2ms).

disableDPB was solution to make decode time constantly.

But, I don’t want to use disableDPB.

Do you think the encoded stream for camera is problem?

Is there any way to solve this problem without using disableDPB()?

Thanks.

---

<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:** [March 9, 2023, 7:35am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/5 "2023-03-09T07:35:59Z")

</div>

Hi  
You can try to parse the h264 streams and do comparison through JM decoder:  
[https://avc.hhi.fraunhofer.de/](https://avc.hhi.fraunhofer.de/)

If decoder keeps more decoded YUVs for the specific camera, the value of reference frame number should be larger in the bitstream.

---

<div class="post-metadata">

**Author:** ![mjnhb20011](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mjnhb20011](https://forums.developer.nvidia.com/u/mjnhb20011)\
**Post date:** [March 14, 2023, 2:17am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/6 "2023-03-14T02:17:11Z")

</div>

Hi, I parsed the h264 stream and found that It decode same YUVs in both camera.

Both Strange and normal stream is Main@3.0 (640 x 360 resolution in 30fps)

I receive only I frame and P frame in both streams. (P frame has one nActiveRefFrame)

Difference in those two camera is normal stream camera uses hisilicon chip and strange stream camera uses ambarella chip.

When I print v4l2\_ctrl\_videodec\_outputbuf\_metadata’s frameType after dqBuffer from capture\_plane received from strange stream  
[I, P Frames (\* 29) (stop while)], [I, P Frames (\* 29), (stop while)], [I, PPP…] → This situation continues. (I think decoding I frame takes long time)

I understand I can call disableDPB if stream has one reference frame.

But I think those two streams need to work same regardless of chip manufacturer.

Do you think this is problem of camera side?

What happens to decoding I frame If I call disableDPB()?

Thanks

---

<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:** [March 14, 2023, 4:56am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/7 "2023-03-14T04:56:27Z")

</div>

Hi,  
Please compare SPS/PPS of the two streams and see if there is deviation. Probably _num\_ref\_frames_ is set to different value in the two streams.

```auto
@43 SPS: num_ref_frames 011 ( 2) 

```

You can enable `TRACEFILE` to get the information.

---

<div class="post-metadata">

**Author:** ![mjnhb20011](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mjnhb20011](https://forums.developer.nvidia.com/u/mjnhb20011)\
**Post date:** [March 14, 2023, 7:52am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/8 "2023-03-14T07:52:03Z")

</div>

I dumped SPS of two streams

> normal stream (hiilicon)  
> ==================== SPS ====================  
> 77 = profile\_idc  
> 0 = constraint\_set0\_flag  
> 0 = constraint\_set1\_flag  
> 0 = constraint\_set2\_flag  
> 0 = constraint\_set3\_flag  
> 0 = constraint\_set4\_flag  
> 0 = constraint\_set5\_flag  
> 0 = reserved\_zero\_2bits  
> 30 = level\_idc  
> 0 = seq\_parameter\_set\_id  
> 0 = chroma\_format\_idc  
> 0 = residual\_colour\_transform\_flag  
> 0 = bit\_depth\_luma\_minus8  
> 0 = bit\_depth\_chroma\_minus8  
> 0 = qpprime\_y\_zero\_transform\_bypass\_flag  
> 0 = seq\_scaling\_matrix\_present\_flag  
> 6 = log2\_max\_frame\_num\_minus4  
> 2 = pic\_order\_cnt\_type  
> 1 = max\_num\_ref\_frames  
> 1 = gaps\_in\_frame\_num\_value\_allowed\_flag  
> 39 (640) = pic\_width\_in\_mbs\_minus1  
> 22 (368) = pic\_height\_in\_map\_units\_minus1  
> 1 = frame\_mbs\_only\_flag  
> 0 = mb\_adaptive\_frame\_field\_flag  
> 1 = direct\_8x8\_inference\_flag  
> 1 = frame\_cropping\_flag  
> 0 = frame\_crop\_left\_offset  
> 0 = frame\_crop\_right\_offset  
> 0 = frame\_crop\_top\_offset  
> 4 = frame\_crop\_bottom\_offset  
> 1 = vui\_parameters\_present\_flag  
> vui\_parameters()  
> 0 = aspect\_ratio\_info\_present\_flag  
> 0 = overscan\_info\_present\_flag  
> 1 = video\_signal\_type\_present\_flag  
> 5 = video\_format  
> 1 = video\_full\_range\_flag  
> 1 = colour\_description\_present\_flag  
> 1 = color\_primaries  
> 1 = transfer\_characteristics  
> 1 = matrix\_coefficients  
> 0 = chroma\_loc\_info\_present\_flag  
> 0 = timing\_info\_present\_flag  
> 0 = nal\_hrd\_parameters\_present\_flag  
> 0 = vcl\_hrd\_parameters\_present\_flag  
> 0 = nal\_hrd\_parameters\_present\_flag||vcl\_hrd\_parameters\_present\_flag  
> 0 = pic\_struct\_present\_flag  
> 0 = bitstream\_restriction\_flag

> strange stream (ambarella)  
> ==================== SPS ====================  
> 77 = profile\_idc  
> 0 = constraint\_set0\_flag  
> 1 = constraint\_set1\_flag  
> 0 = constraint\_set2\_flag  
> 0 = constraint\_set3\_flag  
> 0 = constraint\_set4\_flag  
> 0 = constraint\_set5\_flag  
> 0 = reserved\_zero\_2bits  
> 30 = level\_idc  
> 0 = seq\_parameter\_set\_id  
> 0 = chroma\_format\_idc  
> 0 = residual\_colour\_transform\_flag  
> 0 = bit\_depth\_luma\_minus8  
> 0 = bit\_depth\_chroma\_minus8  
> 0 = qpprime\_y\_zero\_transform\_bypass\_flag  
> 0 = seq\_scaling\_matrix\_present\_flag  
> 12 = log2\_max\_frame\_num\_minus4  
> 0 = pic\_order\_cnt\_type  
> 12 = log2\_max\_pic\_order\_cnt\_lsb\_minus4  
> 1 = max\_num\_ref\_frames  
> 0 = gaps\_in\_frame\_num\_value\_allowed\_flag  
> 39 (640) = pic\_width\_in\_mbs\_minus1  
> 22 (368) = pic\_height\_in\_map\_units\_minus1  
> 1 = frame\_mbs\_only\_flag  
> 0 = mb\_adaptive\_frame\_field\_flag  
> 1 = direct\_8x8\_inference\_flag  
> 1 = frame\_cropping\_flag  
> 0 = frame\_crop\_left\_offset  
> 0 = frame\_crop\_right\_offset  
> 0 = frame\_crop\_top\_offset  
> 4 = frame\_crop\_bottom\_offset  
> 1 = vui\_parameters\_present\_flag  
> vui\_parameters()  
> 1 = aspect\_ratio\_info\_present\_flag  
> 1 = aspect\_ratio\_idc  
> 1:1 = sar  
> 0 = overscan\_info\_present\_flag  
> 1 = video\_signal\_type\_present\_flag  
> 5 = video\_format  
> 1 = video\_full\_range\_flag  
> 1 = colour\_description\_present\_flag  
> 1 = color\_primaries  
> 1 = transfer\_characteristics  
> 1 = matrix\_coefficients  
> 0 = chroma\_loc\_info\_present\_flag  
> 1 = timing\_info\_present\_flag  
> 1000 = num\_units\_in\_tick  
> 60000 = time\_scale  
> 1 = fixed\_frame\_rate\_flag  
> 1 = nal\_hrd\_parameters\_present\_flag  
> hrd\_parameters()  
> 0 = cpb\_cnt\_minus1  
> 4 = bit\_rate\_scale  
> 3 = cpb\_size\_scale  
> 2999 = bit\_rate\_value\_minus1[0]  
> 78124 = cpb\_size\_value\_minus1[0]  
> 0 = cbr\_flag[0]  
> 23 = initial\_cpb\_removal\_delay\_length\_minus1  
> 15 = cpb\_removal\_delay\_length\_minus1  
> 5 = dpb\_output\_delay\_length\_minus1  
> 24 = time\_offset\_length  
> 1 = nal\_hrd\_parameters\_present\_flag||vcl\_hrd\_parameters\_present\_flag  
> 0 = low\_delay\_hrd\_flag  
> 1 = pic\_struct\_present\_flag  
> 0 = bitstream\_restriction\_flag

num\_ref\_frames (max\_num\_ref\_frames) value is same. but the value of _constraint\_set1\_flag_, _log2\_max\_frame\_num\_mins4_ value is different and strange stream has _hrd\_parameters_.

Could those difference make such a result?

Do I need to see something else?

Thanks.

---

<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:** [March 14, 2023, 11:19am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/9 "2023-03-14T11:19:09Z")

</div>

Hi,  
It looks like hrd parameters make the difference. Is it possible to disable it and try ?

---

<div class="post-metadata">

**Author:** ![mjnhb20011](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mjnhb20011](https://forums.developer.nvidia.com/u/mjnhb20011)\
**Post date:** [March 15, 2023, 2:14am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/10 "2023-03-15T02:14:25Z")

</div>

Hi,  
I disabled hrd parameters but symptom was same.  
I found another camera has same symptom which does not send vui\_parameters (H.264 HIGH@4.1)

does value of _log2\_max\_frame\_num\_minus4_ and _pic\_order\_cnt\_type_ can also make difference?

> H.264 HIGH@4.1 SPS dump  
> ==================== SPS ====================  
> 100 = profile\_idc  
> 0 = constraint\_set0\_flag  
> 0 = constraint\_set1\_flag  
> 0 = constraint\_set2\_flag  
> 0 = constraint\_set3\_flag  
> 0 = constraint\_set4\_flag  
> 0 = constraint\_set5\_flag  
> 0 = reserved\_zero\_2bits  
> 41 = level\_idc  
> 0 = seq\_parameter\_set\_id  
> 1 = chroma\_format\_idc  
> 0 = residual\_colour\_transform\_flag  
> 0 = bit\_depth\_luma\_minus8  
> 0 = bit\_depth\_chroma\_minus8  
> 0 = qpprime\_y\_zero\_transform\_bypass\_flag  
> 0 = seq\_scaling\_matrix\_present\_flag  
> 9 = log2\_max\_frame\_num\_minus4  
> 0 = pic\_order\_cnt\_type  
> 2 = log2\_max\_pic\_order\_cnt\_lsb\_minus4  
> 1 = max\_num\_ref\_frames  
> 1 = gaps\_in\_frame\_num\_value\_allowed\_flag  
> 39 (640) = pic\_width\_in\_mbs\_minus1  
> 22 (368) = pic\_height\_in\_map\_units\_minus1  
> 1 = frame\_mbs\_only\_flag  
> 0 = mb\_adaptive\_frame\_field\_flag  
> 1 = direct\_8x8\_inference\_flag  
> 1 = frame\_cropping\_flag  
> 0 = frame\_crop\_left\_offset  
> 0 = frame\_crop\_right\_offset  
> 0 = frame\_crop\_top\_offset  
> 4 = frame\_crop\_bottom\_offset  
> 0 = vui\_parameters\_present\_flag

---

<div class="post-metadata">

**Author:** ![mjnhb20011](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mjnhb20011](https://forums.developer.nvidia.com/u/mjnhb20011)\
**Post date:** [March 20, 2023, 12:49am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/11 "2023-03-20T00:49:02Z")

</div>

Hi, any updates on this issue?

---

<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:** [March 20, 2023, 8:14am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/12 "2023-03-20T08:14:09Z")

</div>

Hi,  
Probably _pic\_order\_cnt\_type_ triggers the difference. Please check if it can be set to identical value for a try.

---

<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:** [April 12, 2023, 5:06am UTC](https://forums.developer.nvidia.com/t/decoding-issuse-in-tx2/245435/14 "2023-04-12T05:06:02Z")

</div>

Closed on April 12, 2023, 5:06am UTC

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