This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM388编码的1080p视频,解码时运动物体出现周期性卡顿现象

Other Parts Discussed in Thread: DM388

DM388编码h264 1080p的视频,帧率为25fps, I帧间隔为25帧。通过无线网络发送给DM8168硬解码,发现解码画面中运动的物体如汽车有周期性卡顿现象。在DM388上将编码后的码流直接保存为文件,然后用PC上的软件播放(Elecard StreamEye Tools)也存在周期性卡顿问题。通过分析发现I帧和P帧的大小差距明显。且在卡顿的发生和I帧有关系。如在编码时仅在第一帧发送I帧,后面不再发送I帧,则解码时没有卡顿问题。

周期性发送I帧引起的运动物体卡顿问题应该如何解决?

Elecard StreamEye Tools解析的视频基本信息:

--------------------------------------------

file type : ES
video stream type : AVC/H.264
resolution : 1920x1080
profile:level : High:5.0
aspect ratio : 16x9(unspecified)
interlaced : no
frames count : 3 513
frame size max : 164 836
avg : 8 408
avg/max (I) : 154 487 / 164 836
avg/max (P) : 2 299 / 33 004
avg/max (B) : 0 / 0
min : 154
file size : 29 537 318
--------------------------------------------

framerate declared : 60.00
--------------------------------------------
real : 60.00

bitrate declared : 4 000 000
--------------------------------------------
real max : 6 428 185
real avg : 4 035 856
real min : 3 408 493
--------------------------------------------

截取的视频中前200帧I帧和P帧大小:

num type offset time size
0 I 0x0000000000000000 00:00.0 49925
1 P 0x000000000000c305 00:00.0 16740
2 P 0x0000000000010469 00:00.0 3650
3 P 0x00000000000112ab 00:00.0 3989
4 P 0x0000000000012240 00:00.1 4644
5 P 0x0000000000013464 00:00.1 5003
6 P 0x00000000000147ef 00:00.1 7065
7 P 0x0000000000016388 00:00.1 2577
8 P 0x0000000000016d99 00:00.1 16335
9 P 0x000000000001ad68 00:00.1 282
10 P 0x000000000001ae82 00:00.2 3931
11 P 0x000000000001bddd 00:00.2 3888
12 P 0x000000000001cd0d 00:00.2 13448
13 P 0x0000000000020195 00:00.2 480
14 P 0x0000000000020375 00:00.2 7590
15 P 0x000000000002211b 00:00.2 1281
16 P 0x000000000002261c 00:00.3 26102
17 P 0x0000000000028c12 00:00.3 154
18 P 0x0000000000028cac 00:00.3 3938
19 P 0x0000000000029c0e 00:00.3 4682
20 P 0x000000000002ae58 00:00.3 8059
21 P 0x000000000002cdd3 00:00.3 3336
22 P 0x000000000002dadb 00:00.4 33004
23 P 0x0000000000035bc7 00:00.4 166
24 P 0x0000000000035c6d 00:00.4 4968
25 I 0x0000000000036fd5 00:00.4 154561
26 P 0x000000000005cb96 00:00.4 2517
27 P 0x000000000005d56b 00:00.4 7287
28 P 0x000000000005f1e2 00:00.5 2238
29 P 0x000000000005faa0 00:00.5 10310
30 P 0x00000000000622e6 00:00.5 1619
31 P 0x0000000000062939 00:00.5 5910
32 P 0x000000000006404f 00:00.5 3797
33 P 0x0000000000064f24 00:00.5 8821
34 P 0x0000000000067199 00:00.6 1692
35 P 0x0000000000067835 00:00.6 8119
36 P 0x00000000000697ec 00:00.6 2722
37 P 0x000000000006a28e 00:00.6 13348
38 P 0x000000000006d6b2 00:00.6 1012
39 P 0x000000000006daa6 00:00.6 9458
40 P 0x000000000006ff98 00:00.7 2892
41 P 0x0000000000070ae4 00:00.7 6065
42 P 0x0000000000072295 00:00.7 4997
43 P 0x000000000007361a 00:00.7 6121
44 P 0x0000000000074e03 00:00.7 5584
45 P 0x00000000000763d3 00:00.7 5786
46 P 0x0000000000077a6d 00:00.8 5522
47 P 0x0000000000078fff 00:00.8 7646
48 P 0x000000000007addd 00:00.8 3433
49 P 0x000000000007bb46 00:00.8 11473
50 I 0x000000000007e817 00:00.8 158192
51 P 0x00000000000a5207 00:00.8 2231
52 P 0x00000000000a5abe 00:00.9 10441
53 P 0x00000000000a8387 00:00.9 5603
54 P 0x00000000000a996a 00:00.9 8641
55 P 0x00000000000abb2b 00:00.9 5192
56 P 0x00000000000acf73 00:00.9 7841
57 P 0x00000000000aee14 00:00.9 4726
58 P 0x00000000000b008a 00:01.0 7820
59 P 0x00000000000b1f16 00:01.0 3671
60 P 0x00000000000b2d6d 00:01.0 13509
61 P 0x00000000000b6232 00:01.0 1267
62 P 0x00000000000b6725 00:01.0 12565
63 P 0x00000000000b983a 00:01.0 2928
64 P 0x00000000000ba3aa 00:01.1 6508
65 P 0x00000000000bbd16 00:01.1 5736
66 P 0x00000000000bd37e 00:01.1 6096
67 P 0x00000000000beb4e 00:01.1 5976
68 P 0x00000000000c02a6 00:01.1 6159
69 P 0x00000000000c1ab5 00:01.1 5950
70 P 0x00000000000c31f3 00:01.2 5821
71 P 0x00000000000c48b0 00:01.2 7330
72 P 0x00000000000c6552 00:01.2 5407
73 P 0x00000000000c7a71 00:01.2 7050
74 P 0x00000000000c95fb 00:01.2 5333
75 I 0x00000000000caad0 00:01.2 162553
76 P 0x00000000000f25c9 00:01.3 2487
77 P 0x00000000000f2f80 00:01.3 3086
78 P 0x00000000000f3b8e 00:01.3 2029
79 P 0x00000000000f437b 00:01.3 2148
80 P 0x00000000000f4bdf 00:01.3 1845
81 P 0x00000000000f5314 00:01.3 1867
82 P 0x00000000000f5a5f 00:01.4 1867
83 P 0x00000000000f61aa 00:01.4 1564
84 P 0x00000000000f67c6 00:01.4 1477
85 P 0x00000000000f6d8b 00:01.4 1125
86 P 0x00000000000f71f0 00:01.4 1251
87 P 0x00000000000f76d3 00:01.4 1139
88 P 0x00000000000f7b46 00:01.5 1086
89 P 0x00000000000f7f84 00:01.5 1094
90 P 0x00000000000f83ca 00:01.5 785
91 P 0x00000000000f86db 00:01.5 983
92 P 0x00000000000f8ab2 00:01.5 733
93 P 0x00000000000f8d8f 00:01.5 9226
94 P 0x00000000000fb199 00:01.6 1195
95 P 0x00000000000fb644 00:01.6 3526
96 P 0x00000000000fc40a 00:01.6 3353
97 P 0x00000000000fd123 00:01.6 6345
98 P 0x00000000000fe9ec 00:01.6 2825
99 P 0x00000000000ff4f5 00:01.6 10338
100 I 0x0000000000101d57 00:01.7 149305
101 P 0x0000000000126490 00:01.7 1354
102 P 0x00000000001269da 00:01.7 3493
103 P 0x000000000012777f 00:01.7 2002
104 P 0x0000000000127f51 00:01.7 2234
105 P 0x000000000012880b 00:01.7 1247
106 P 0x0000000000128cea 00:01.8 1830
107 P 0x0000000000129410 00:01.8 1350
108 P 0x0000000000129956 00:01.8 1368
109 P 0x0000000000129eae 00:01.8 1245
110 P 0x000000000012a38b 00:01.8 880
111 P 0x000000000012a6fb 00:01.8 1129
112 P 0x000000000012ab64 00:01.9 869
113 P 0x000000000012aec9 00:01.9 877
114 P 0x000000000012b236 00:01.9 860
115 P 0x000000000012b592 00:01.9 913
116 P 0x000000000012b923 00:01.9 950
117 P 0x000000000012bcd9 00:01.9 908
118 P 0x000000000012c065 00:02.0 7718
119 P 0x000000000012de8b 00:02.0 1314
120 P 0x000000000012e3ad 00:02.0 9011
121 P 0x00000000001306e0 00:02.0 1489
122 P 0x0000000000130cb1 00:02.0 3545
123 P 0x0000000000131a8a 00:02.0 4572
124 P 0x0000000000132c66 00:02.1 4474
125 I 0x0000000000133de0 00:02.1 159160
126 P 0x000000000015ab98 00:02.1 1177
127 P 0x000000000015b031 00:02.1 1884
128 P 0x000000000015b78d 00:02.1 1388
129 P 0x000000000015bcf9 00:02.1 1394
130 P 0x000000000015c26b 00:02.2 1401
131 P 0x000000000015c7e4 00:02.2 1135
132 P 0x000000000015cc53 00:02.2 1141
133 P 0x000000000015d0c8 00:02.2 1723
134 P 0x000000000015d783 00:02.2 2545
135 P 0x000000000015e174 00:02.2 2088
136 P 0x000000000015e99c 00:02.3 1383
137 P 0x000000000015ef03 00:02.3 4897
138 P 0x0000000000160224 00:02.3 968
139 P 0x00000000001605ec 00:02.3 3744
140 P 0x000000000016148c 00:02.3 3074
141 P 0x000000000016208e 00:02.3 3207
142 P 0x0000000000162d15 00:02.4 2053
143 P 0x000000000016351a 00:02.4 4476
144 P 0x0000000000164696 00:02.4 1829
145 P 0x0000000000164dbb 00:02.4 4234
146 P 0x0000000000165e45 00:02.4 7184
147 P 0x0000000000167a55 00:02.4 2642
148 P 0x00000000001684a7 00:02.5 6692
149 P 0x0000000000169ecb 00:02.5 823
150 I 0x000000000016a202 00:02.5 119485
151 P 0x00000000001874bf 00:02.5 432
152 P 0x000000000018766f 00:02.5 480
153 P 0x000000000018784f 00:02.5 452
154 P 0x0000000000187a13 00:02.6 481
155 P 0x0000000000187bf4 00:02.6 467
156 P 0x0000000000187dc7 00:02.6 463
157 P 0x0000000000187f96 00:02.6 472
158 P 0x000000000018816e 00:02.6 534
159 P 0x0000000000188384 00:02.6 939
160 P 0x000000000018872f 00:02.7 1218
161 P 0x0000000000188bf1 00:02.7 1872
162 P 0x0000000000189341 00:02.7 1689
163 P 0x00000000001899da 00:02.7 1128
164 P 0x0000000000189e42 00:02.7 9253
165 P 0x000000000018c267 00:02.7 958
166 P 0x000000000018c625 00:02.8 3038
167 P 0x000000000018d203 00:02.8 3716
168 P 0x000000000018e087 00:02.8 2722
169 P 0x000000000018eb29 00:02.8 4580
170 P 0x000000000018fd0d 00:02.8 2595
171 P 0x0000000000190730 00:02.8 5590
172 P 0x0000000000191d06 00:02.9 1518
173 P 0x00000000001922f4 00:02.9 8692
174 P 0x00000000001944e8 00:02.9 1102
175 I 0x0000000000194936 00:02.9 137324
176 P 0x00000000001b61a2 00:02.9 759
177 P 0x00000000001b6499 00:02.9 891
178 P 0x00000000001b6814 00:03.0 920
179 P 0x00000000001b6bac 00:03.0 931
180 P 0x00000000001b6f4f 00:03.0 788
181 P 0x00000000001b7263 00:03.0 879
182 P 0x00000000001b75d2 00:03.0 729
183 P 0x00000000001b78ab 00:03.0 726
184 P 0x00000000001b7b81 00:03.1 636
185 P 0x00000000001b7dfd 00:03.1 685
186 P 0x00000000001b80aa 00:03.1 704
187 P 0x00000000001b836a 00:03.1 5537
188 P 0x00000000001b990b 00:03.1 1228
189 P 0x00000000001b9dd7 00:03.1 6438
190 P 0x00000000001bb6fd 00:03.2 1859
191 P 0x00000000001bbe40 00:03.2 7960
192 P 0x00000000001bdd58 00:03.2 1572
193 P 0x00000000001be37c 00:03.2 11798
194 P 0x00000000001c1192 00:03.2 892
195 P 0x00000000001c150e 00:03.2 4494
196 P 0x00000000001c269c 00:03.3 3811
197 P 0x00000000001c357f 00:03.3 6644
198 P 0x00000000001c4f73 00:03.3 2730
199 P 0x00000000001c5a1d 00:03.3 12011
200 I 0x00000000001c8908 00:03.3 138489
201 P 0x00000000001ea601 00:03.3 1408
202 P 0x00000000001eab81 00:03.4 3756
203 P 0x00000000001eba2d 00:03.4 2027
204 P 0x00000000001ec218 00:03.4 2088
205 P 0x00000000001eca40 00:03.4 1492
206 P 0x00000000001ed014 00:03.4 1638
207 P 0x00000000001ed67a 00:03.4 1463
208 P 0x00000000001edc31 00:03.5 1116
209 P 0x00000000001ee08d 00:03.5 1030
210 P 0x00000000001ee493 00:03.5 952
211 P 0x00000000001ee84b 00:03.5 905
212 P 0x00000000001eebd4 00:03.5 835
213 P 0x00000000001eef17 00:03.5 941
214 P 0x00000000001ef2c4 00:03.6 9435
215 P 0x00000000001f179f 00:03.6 993
216 P 0x00000000001f1b80 00:03.6 3325
217 P 0x00000000001f287d 00:03.6 4427
218 P 0x00000000001f39c8 00:03.6 5250
219 P 0x00000000001f4e4a 00:03.6 3991
220 P 0x00000000001f5de1 00:03.7 7179
221 P 0x00000000001f79ec 00:03.7 2349
222 P 0x00000000001f8319 00:03.7 16279
223 P 0x00000000001fc2b0 00:03.7 764
224 P 0x00000000001fc5ac 00:03.7 8171
225 I 0x00000000001fe597 00:03.7 152339
226 P 0x00000000002238aa 00:03.8 618
227 P 0x0000000000223b14 00:03.8 2128
228 P 0x0000000000224364 00:03.8 1460
229 P 0x0000000000224918 00:03.8 1426
230 P 0x0000000000224eaa 00:03.8 1427
231 P 0x000000000022543d 00:03.8 1045
232 P 0x0000000000225852 00:03.9 1205
233 P 0x0000000000225d07 00:03.9 963
234 P 0x00000000002260ca 00:03.9 938
235 P 0x0000000000226474 00:03.9 857
236 P 0x00000000002267cd 00:03.9 830
237 P 0x0000000000226b0b 00:03.9 577
238 P 0x0000000000226d4c 00:04.0 593
239 P 0x0000000000226f9d 00:04.0 559
240 P 0x00000000002271cc 00:04.0 406
241 P 0x0000000000227362 00:04.0 497
242 P 0x0000000000227553 00:04.0 10506
243 P 0x0000000000229e5d 00:04.0 407
244 P 0x0000000000229ff4 00:04.1 2675
245 P 0x000000000022aa67 00:04.1 3641
246 P 0x000000000022b8a0 00:04.1 4893
247 P 0x000000000022cbbd 00:04.1 4534
248 P 0x000000000022dd73 00:04.1 5021
249 P 0x000000000022f110 00:04.1 4571
250 I 0x00000000002302eb 00:04.2 162076
  • 你好,

    你需要分析一下IVAHD h264enc的参数配置。有一个skipframe的参数,你看看目前是否有使能,如果有,请关闭该功能看看。
  • 您好,

    我在编码参数里没找到skipframe这个参数。把我们现在用的编码参数和保存的.264文件贴上来了。

    播放.264视频文件可以看到汽车向前运行的时候,总是周期性的一顿一顿的,不流畅。麻烦帮我们分析下哪些参数会导致这个问题? 多谢!

    编码参数:

    /* ENC link !!! */
    MULTICH_INIT_STRUCT(EncLink_CreateParams, encPrm);
    {
    EncLink_ChCreateParams *pLinkChPrm;
    EncLink_ChDynamicParams *pLinkDynPrm;

    for (i = 0; i < VENC_PRIMARY_CHANNELS; i++)
    {
    pLinkChPrm = &encPrm.chCreateParams[i];
    pLinkDynPrm = &pLinkChPrm->defaultDynamicParams;

    pLinkChPrm->format = IVIDEO_H264HP; /* IVIDEO_H264BP=7, IVIDEO_H264MP=8, IVIDEO_H264HP=9 */
    pLinkChPrm->profile = IH264_HIGH_PROFILE; /* IH264_BASELINE_PROFILE, IH264_MAIN_PROFILE, IH264_HIGH_PROFILE */
    pLinkChPrm->dataLayout = IVIDEO_PROGRESSIVE; /* IVIDEO_PROGRESSIVE=0, IVIDEO_INTERLACED=1 ??? */ //IVIDEO_FIELD_SEPARATED;
    pLinkChPrm->fieldMergeEncodeEnable = FALSE;
    pLinkChPrm->enableAnalyticinfo = 0;
    pLinkChPrm->enableWaterMarking = 0;
    // pLinkChPrm->minBitRate = 0;
    pLinkChPrm->maxBitRate = -1;
    pLinkChPrm->encodingPreset = XDM_HIGH_SPEED; /* XDM_DEFAULT=0, XDM_HIGH_QUALITY=1, XDM_HIGH_SPEED=2, XDM_USER_DEFINED=3 */
    pLinkChPrm->StreamPreset = 2; //HIGH_QUALITY // ???
    pLinkChPrm->rateControlPreset = IVIDEO_LOW_DELAY; /* IVIDEO_LOW_DELAY=1, IVIDEO_STORAGE=2, IVIDEO_USER_DEFINED=5 */
    pLinkChPrm->enableHighSpeed = FALSE;

    pLinkDynPrm->intraFrameInterval = 25;
    pLinkDynPrm->targetBitRate = 4000000;
    pLinkDynPrm->inputFrameRate = 25;

    pLinkDynPrm->interFrameInterval = 1;
    pLinkDynPrm->mvAccuracy = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
    pLinkDynPrm->rcAlg = VENC_RATE_CTRL_VBR; //=0;
    pLinkDynPrm->qpMin = 10;
    pLinkDynPrm->qpMax = 40;
    pLinkDynPrm->qpInit = -1;
    pLinkDynPrm->vbrDuration = 8;
    pLinkDynPrm->vbrSensitivity = 0;

    encPrm.numBufPerCh[i] = NUM_ENCODE_BUFFERS;
    }
    }

    2514.gq-061601.7z

  • 你好,

    请参考我之前回答其他讨论的信息:
    e2echina.ti.com/.../306381
  • 您好,
    306381里面提到的参数, 查看log发现目前numSkipInDistributionWindow被配置为1了。但是在代码里没有找到修改这个参数的地方。
    能指点一下应该怎么修改这个参数吗?

    目前参数配置
    rateControlParams -> allowFrameSkip : 0
    rateControlParams -> skipDistributionWindowLength: 5
    rateControlParams -> numSkipInDistributionWindow : 1
  • 你好,

    请问你使用的软件以及版本是?
  • 你好,

    我们是基于IPNC_RDK_GA_Release3.8.0 mcfw架构写的h264编码软件。
    h264编码器的版本号是 REL.500.V.H264AVC.E.IVAHD.02.00.07.01。
  • 你好,

    在encLink_h264.c里面的静态和动态rateControlParams参数设置的地方,添加对frame skip相关的设置。
  • 你好,

    1. numSkipInDistributionWindow这个参数作用是什么呢?是和跳帧有关系吗?
    现在感觉我们的问题不像是跳帧了,汽车卡顿是遇到Idr帧了。通过Elecard工具我对比了Idr帧和它前后的P帧,发现汽车相较于上一帧图像中的位置,前进的距离相差不大。所以感觉不像跳帧。

    2. 我们昨天试了把EncLink_ChDynamicParams里的qpMin从之前的10改为30。发现Idr帧的大小由150KB变为30KB左右。同时运动的汽车周期性卡顿的问题有所缓解,卡顿还存在但没有之前明显了。周期性发送Idr帧且Idr帧比P帧大这种情况会对硬解码有影响吗?

    pLinkDynPrm->qpMin = 30;
  • user5919965 说:
    1. numSkipInDistributionWindow这个参数作用是什么呢?是和跳帧有关系吗?

    你可以在h264enc user guide里面找的下面的信息:

    Number of skips allowed within the distribution window.

    如果设置是

    rateControlParams -> skipDistributionWindowLength: 5
    rateControlParams -> numSkipInDistributionWindow : 1

    那就是5帧里面丢一帧。

  • user5919965 说:
    2. 我们昨天试了把EncLink_ChDynamicParams里的qpMin从之前的10改为30。发现Idr帧的大小由150KB变为30KB左右。同时运动的汽车周期性卡顿的问题有所缓解,卡顿还存在但没有之前明显了。周期性发送Idr帧且Idr帧比P帧大这种情况会对硬解码有影响吗?

    pLinkDynPrm->qpMin = 30;

    qpMin改大,会损失图像质量。我建议你把target bitrate加大,看看是否有改善。