Time stamp problems after resetting the encoding parameters

Time stamp problems after resetting the encoding parameters

Hi,

I have successfully reset the encoding parameter during the transcoding process. And, I have also drained all cached frames in the encoder before reset. Consequently, the programme seemed to be okay but actually not.

The programme was supposed to change the encoding parameters every several frames. But it just encountered an unpredictable error randomly, which meant sometimes the programme worked fine without such an error.

I checked the detailed frame type and time stamp, and one of the error is shown below.

PTS:    477  ( I ), DTS:    476
PTS:    481  ( P ), DTS:    477
PTS:    478  ( B ), DTS:    478
PTS:    479  ( B ), DTS:    479
PTS:    480  ( B ), DTS:    480
PTS:    485  ( P ), DTS:    481
PTS:    482  ( B ), DTS:    482
PTS:    483  ( B ), DTS:    483
PTS:    484  ( B ), DTS:    484
PTS:    489  ( P ), DTS:    485
PTS:    486  ( B ), DTS:    486
PTS:    487  ( B ), DTS:    487
PTS:    488  ( B ), DTS:    488
PTS:    493  ( P ), DTS:    489
PTS:    490  ( B ), DTS:    490
Parameter need to change!
Drain Encoder
PTS:    491  ( B ), DTS:    491
PTS:    492  ( B ), DTS:    492
PTS:    497  ( P ), DTS:    493
PTS:    494  ( B ), DTS:    494
PTS:    495  ( B ), DTS:    495
PTS:    496  ( B ), DTS:    496

Parameter changed successfully!
PTS:    500  ( P ), DTS:    497
PTS:    498  ( B ), DTS:    498
PTS:    499  ( B ), DTS:    499
PTS:    501  ( I ), DTS:    500
PTS:    505  ( P ), DTS:    501
PTS:    502  ( B ), DTS:    502
PTS:    503  ( B ), DTS:    503
PTS:    504  ( B ), DTS:    504
PTS:    509  ( P ), DTS:    505
PTS:    506  ( B ), DTS:    506
PTS:    510  ( B ), DTS:    510
PTS:    508  ( B ), DTS:    508
[flv @ 0000008755b87dc0] Application provided invalid, non monotonically increas
ing dts to muxer in stream 0: 21271 >= 21188
FFMPEG: Error while writing video frame

As can be seen that the penultimate frame listed above should be "507" instead of "510".

Any idea why?

 

Regards,

Zheng

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Well, I tried to set the GOP pattern to all I frames instead of the previous one.

FROM:

mfxEncParams.mfx.GopPicSize  = 25;
mfxEncParams.mfx.GopRefDist  = 4;

 

TO:

mfxEncParams.mfx.GopPicSize  = 1;
mfxEncParams.mfx.GopRefDist  = 1;

Such random error seemed not to happen with this settings.

Personally, the reset of encoder will change the "IPB GOP pattern" somehow and brings the random error. So, is it possible to avoid such problem in other ways? And how do the EncodeFrameAsync organize the GOP pattern?

 

Regards,

Zheng

Problem was solved when I change to use MKV format.

Leave a Comment

Please sign in to add a comment. Not a member? Join today