On Wed, 30 Apr 2014 16:37:04 +0530
Abhishek Maniyar <[email protected]> wrote:

> But how can i sort them? I get older packet after am done displaying the 
> later one.

You know that for each packet you feed to the decoder, you get back a
decoded frame. So you put all packet PTS values in an array, and pick
the PTS with the lowest value each time a frame is output.

> Also there looks like a overlap in block.. if we see the first part, the PTS 
> looks like properly organised. next PTS is at expected time. But after some 
> time, we see packets for same time block, which look right to.. even in there 
> next PTS is at tight time wrt to previous. 
> I am unable to understand how can I get different packets for same time block 
> after some time?
> In the following example , I am getting frames for time stamp 21904 to 22264 
> twice. And if we see to both blocks of data independently, they both look 
> complete. 

Then I don't know. (Though I don't see any double timestamps, maybe
bring the output in a more readable and less redundant format?)

> Reorder is when packets are not in order. But here it looks like there are 
> enough packets in both the sections. Thats what is confusing me more. 
> 
> 2014-04-29 12:26:50.878 MyPlayer[197:5c07] PTS: 21904.921875(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:50.917 MyPlayer[197:5c07] PTS: 21945.855469(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:50.960 MyPlayer[197:5c07] PTS: 21986.033203(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:51.000 MyPlayer[197:5c07] PTS: 22025.255859(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:51.040 MyPlayer[197:5c07] PTS: 22069.566406(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:51.081 MyPlayer[197:5c07] PTS: 22105.255859(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:51.122 MyPlayer[197:5c07] PTS: 22145.322266(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:51.165 MyPlayer[197:5c07] PTS: 22184.611328(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:51.204 MyPlayer[197:5c07] PTS: 22225.812500(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:51.250 MyPlayer[197:5c07] PTS: 22264.457031(Duration : 
> 40.000000) Bufferred: 3600.00
> .
> .
> .
> 2014-04-29 12:26:53.304 MyPlayer[197:5c07] Got older packet (21924.312500): 50
> 2014-04-29 12:26:53.306 MyPlayer[197:5c07] PTS: 21924.312500(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:53.343 MyPlayer[197:5c07] Got older packet (21965.599609): 51
> 2014-04-29 12:26:53.347 MyPlayer[197:5c07] PTS: 21965.599609(Duration : 
> 40.000000) Bufferred: 3600.00
> 2014-04-29 12:26:53.350 MyPlayer[197:5c07] Got older packet (22004.466797): 52
> 2014-04-29 12:26:53.352 MyPlayer[197:5c07] PTS: 22004.466797(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.391 MyPlayer[197:5c07] Got older packet (22043.710938): 53
> 2014-04-29 12:26:53.393 MyPlayer[197:5c07] PTS: 22043.710938(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.424 MyPlayer[197:5c07] Got older packet (22084.667969): 54
> 2014-04-29 12:26:53.427 MyPlayer[197:5c07] PTS: 22084.667969(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.473 MyPlayer[197:5c07] Got older packet (22124.066406): 55
> 2014-04-29 12:26:53.476 MyPlayer[197:5c07] PTS: 22124.066406(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.506 MyPlayer[197:5c07] Got older packet (22164.800781): 56
> 2014-04-29 12:26:53.507 MyPlayer[197:5c07] PTS: 22164.800781(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.549 MyPlayer[197:5c07] Got older packet (22205.644531): 57
> 2014-04-29 12:26:53.551 MyPlayer[197:5c07] PTS: 22205.644531(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.590 MyPlayer[197:5c07] Got older packet (22244.023438): 58
> 2014-04-29 12:26:53.593 MyPlayer[197:5c07] PTS: 22244.023438(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.628 MyPlayer[197:5c07] Got older packet (22283.644531): 59
> 2014-04-29 12:26:53.631 MyPlayer[197:5c07] PTS: 22283.644531(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.668 MyPlayer[197:5c07] PTS: 22324.710938(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.712 MyPlayer[197:5c07] PTS: 22364.267578(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.751 MyPlayer[197:5c07] PTS: 22404.044922(Duration : 
> 40.000000) Bufferred: 3640.00
> 2014-04-29 12:26:53.793 MyPlayer[197:5c07] PTS: 22444.888672(Duration : 
> 40.000000) Bufferred: 3640.00
> 
> 
> On 30-Apr-2014, at 4:13 PM, wm4 <[email protected]> wrote:
> 
> > On Wed, 30 Apr 2014 16:05:22 +0530
> > Abhishek Maniyar <[email protected]> wrote:
> > 
> >> I am new to using FFMPEG. 
> >> 
> >> YES, I am calculating PTS as "frame.pts = packet.pts *_videoTimeBase;". I 
> >> am not using FFMPEG decoder(using a 3rd party decoder). So i don't have 
> >> AVFrame. Hence only PTS I have is the one I get from AVPacket. I have 
> >> printed PTS in the sequence I get packet from (av_read_frame)
> >> 
> >> Please see the following log:
> >> .
> >> .
> >> .
> >> .
> >> .
> >> 2014-04-29 12:26:50.878 MyPlayer[197:5c07] PTS: 21904.921875(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:50.917 MyPlayer[197:5c07] PTS: 21945.855469(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:50.960 MyPlayer[197:5c07] PTS: 21986.033203(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.000 MyPlayer[197:5c07] PTS: 22025.255859(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.040 MyPlayer[197:5c07] PTS: 22069.566406(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.081 MyPlayer[197:5c07] PTS: 22105.255859(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.122 MyPlayer[197:5c07] PTS: 22145.322266(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.165 MyPlayer[197:5c07] PTS: 22184.611328(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.204 MyPlayer[197:5c07] PTS: 22225.812500(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.250 MyPlayer[197:5c07] PTS: 22264.457031(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.293 MyPlayer[197:5c07] PTS: 22305.322266(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.332 MyPlayer[197:5c07] Got older packet 
> >> (19965.955078): 1
> >> 2014-04-29 12:26:51.333 MyPlayer[197:5c07] PTS: 19965.955078(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.372 MyPlayer[197:5c07] Got older packet 
> >> (20004.978516): 2
> >> 2014-04-29 12:26:51.375 MyPlayer[197:5c07] PTS: 20004.978516(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.412 MyPlayer[197:5c07] Got older packet 
> >> (20045.822266): 3
> >> 2014-04-29 12:26:51.415 MyPlayer[197:5c07] PTS: 20045.822266(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.456 MyPlayer[197:5c07] Got older packet 
> >> (20085.267578): 4
> >> 2014-04-29 12:26:51.460 MyPlayer[197:5c07] PTS: 20085.267578(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.500 MyPlayer[197:5c07] Got older packet 
> >> (20124.734375): 5
> >> 2014-04-29 12:26:51.503 MyPlayer[197:5c07] PTS: 20124.734375(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.545 MyPlayer[197:5c07] Got older packet 
> >> (20166.222656): 6
> >> 2014-04-29 12:26:51.547 MyPlayer[197:5c07] PTS: 20166.222656(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.590 MyPlayer[197:5c07] Got older packet 
> >> (20205.333984): 7
> >> 2014-04-29 12:26:51.592 MyPlayer[197:5c07] PTS: 20205.333984(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.630 MyPlayer[197:5c07] Got older packet 
> >> (20245.044922): 8
> >> 2014-04-29 12:26:51.632 MyPlayer[197:5c07] PTS: 20245.044922(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.664 MyPlayer[197:5c07] Got older packet 
> >> (20286.201172): 9
> >> 2014-04-29 12:26:51.666 MyPlayer[197:5c07] PTS: 20286.201172(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:51.672 MyPlayer[197:5c07] Got older packet 
> >> (20324.777344): 10
> >> 2014-04-29 12:26:51.673 MyPlayer[197:5c07] PTS: 20324.777344(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.708 MyPlayer[197:5c07] Got older packet 
> >> (20364.800781): 11
> >> 2014-04-29 12:26:51.709 MyPlayer[197:5c07] PTS: 20364.800781(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.745 MyPlayer[197:5c07] Got older packet 
> >> (20405.623047): 12
> >> 2014-04-29 12:26:51.748 MyPlayer[197:5c07] PTS: 20405.623047(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.785 MyPlayer[197:5c07] Got older packet 
> >> (20445.867188): 13
> >> 2014-04-29 12:26:51.789 MyPlayer[197:5c07] PTS: 20445.867188(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.827 MyPlayer[197:5c07] Got older packet 
> >> (20484.888672): 14
> >> 2014-04-29 12:26:51.829 MyPlayer[197:5c07] PTS: 20484.888672(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.866 MyPlayer[197:5c07] Got older packet 
> >> (20525.466797): 15
> >> 2014-04-29 12:26:51.867 MyPlayer[197:5c07] PTS: 20525.466797(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.915 MyPlayer[197:5c07] Got older packet 
> >> (20566.177734): 16
> >> 2014-04-29 12:26:51.916 MyPlayer[197:5c07] PTS: 20566.177734(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.947 MyPlayer[197:5c07] Got older packet 
> >> (20605.355469): 17
> >> 2014-04-29 12:26:51.949 MyPlayer[197:5c07] PTS: 20605.355469(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:51.989 MyPlayer[197:5c07] Got older packet 
> >> (20645.867188): 18
> >> 2014-04-29 12:26:51.991 MyPlayer[197:5c07] PTS: 20645.867188(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.029 MyPlayer[197:5c07] Got older packet 
> >> (20685.066406): 19
> >> 2014-04-29 12:26:52.034 MyPlayer[197:5c07] PTS: 20685.066406(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.077 MyPlayer[197:5c07] Got older packet 
> >> (20725.000000): 20
> >> 2014-04-29 12:26:52.080 MyPlayer[197:5c07] PTS: 20725.000000(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.110 MyPlayer[197:5c07] Got older packet 
> >> (20766.000000): 21
> >> 2014-04-29 12:26:52.112 MyPlayer[197:5c07] PTS: 20766.000000(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.152 MyPlayer[197:5c07] Got older packet 
> >> (20805.222656): 22
> >> 2014-04-29 12:26:52.160 MyPlayer[197:5c07] PTS: 20805.222656(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.194 MyPlayer[197:5c07] Got older packet 
> >> (20844.689453): 23
> >> 2014-04-29 12:26:52.197 MyPlayer[197:5c07] PTS: 20844.689453(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.234 MyPlayer[197:5c07] Got older packet 
> >> (20886.333984): 24
> >> 2014-04-29 12:26:52.238 MyPlayer[197:5c07] PTS: 20886.333984(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.272 MyPlayer[197:5c07] Got older packet 
> >> (20924.800781): 25
> >> 2014-04-29 12:26:52.275 MyPlayer[197:5c07] PTS: 20924.800781(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.313 MyPlayer[197:5c07] Got older packet 
> >> (20964.378906): 26
> >> 2014-04-29 12:26:52.315 MyPlayer[197:5c07] PTS: 20964.378906(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.359 MyPlayer[197:5c07] Got older packet 
> >> (21006.044922): 27
> >> 2014-04-29 12:26:52.360 MyPlayer[197:5c07] PTS: 21006.044922(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.396 MyPlayer[197:5c07] Got older packet 
> >> (21045.267578): 28
> >> 2014-04-29 12:26:52.398 MyPlayer[197:5c07] PTS: 21045.267578(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.440 MyPlayer[197:5c07] Got older packet 
> >> (21083.912109): 29
> >> 2014-04-29 12:26:52.449 MyPlayer[197:5c07] PTS: 21083.912109(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.476 MyPlayer[197:5c07] Got older packet 
> >> (21125.689453): 30
> >> 2014-04-29 12:26:52.478 MyPlayer[197:5c07] PTS: 21125.689453(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.517 MyPlayer[197:5c07] Got older packet 
> >> (21165.023438): 31
> >> 2014-04-29 12:26:52.522 MyPlayer[197:5c07] PTS: 21165.023438(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.557 MyPlayer[197:5c07] Got older packet 
> >> (21204.289062): 32
> >> 2014-04-29 12:26:52.558 MyPlayer[197:5c07] PTS: 21204.289062(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.598 MyPlayer[197:5c07] Got older packet 
> >> (21245.644531): 33
> >> 2014-04-29 12:26:52.600 MyPlayer[197:5c07] PTS: 21245.644531(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.639 MyPlayer[197:5c07] Got older packet 
> >> (21285.156250): 34
> >> 2014-04-29 12:26:52.641 MyPlayer[197:5c07] PTS: 21285.156250(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.679 MyPlayer[197:5c07] Got older packet 
> >> (21323.623047): 35
> >> 2014-04-29 12:26:52.681 MyPlayer[197:5c07] PTS: 21323.623047(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:52.735 MyPlayer[197:5c07] Got older packet 
> >> (21370.267578): 36
> >> 2014-04-29 12:26:52.736 MyPlayer[197:5c07] PTS: 21370.267578(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.773 MyPlayer[197:5c07] Got older packet 
> >> (21405.111328): 37
> >> 2014-04-29 12:26:52.774 MyPlayer[197:5c07] PTS: 21405.111328(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.811 MyPlayer[197:5c07] Got older packet 
> >> (21444.957031): 38
> >> 2014-04-29 12:26:52.813 MyPlayer[197:5c07] PTS: 21444.957031(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.844 MyPlayer[197:5c07] Got older packet 
> >> (21485.667969): 39
> >> 2014-04-29 12:26:52.862 MyPlayer[197:5c07] PTS: 21485.667969(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.892 MyPlayer[197:5c07] Got older packet 
> >> (21525.134766): 40
> >> 2014-04-29 12:26:52.893 MyPlayer[197:5c07] PTS: 21525.134766(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.943 MyPlayer[197:5c07] Got older packet 
> >> (21565.066406): 41
> >> 2014-04-29 12:26:52.944 MyPlayer[197:5c07] PTS: 21565.066406(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:52.974 MyPlayer[197:5c07] Got older packet 
> >> (21605.466797): 42
> >> 2014-04-29 12:26:52.975 MyPlayer[197:5c07] PTS: 21605.466797(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.016 MyPlayer[197:5c07] Got older packet 
> >> (21645.267578): 43
> >> 2014-04-29 12:26:53.021 MyPlayer[197:5c07] PTS: 21645.267578(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.056 MyPlayer[197:5c07] Got older packet 
> >> (21684.777344): 44
> >> 2014-04-29 12:26:53.058 MyPlayer[197:5c07] PTS: 21684.777344(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.099 MyPlayer[197:5c07] Got older packet 
> >> (21725.289062): 45
> >> 2014-04-29 12:26:53.101 MyPlayer[197:5c07] PTS: 21725.289062(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.139 MyPlayer[197:5c07] Got older packet 
> >> (21764.800781): 46
> >> 2014-04-29 12:26:53.141 MyPlayer[197:5c07] PTS: 21764.800781(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.179 MyPlayer[197:5c07] Got older packet 
> >> (21804.066406): 47
> >> 2014-04-29 12:26:53.180 MyPlayer[197:5c07] PTS: 21804.066406(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.220 MyPlayer[197:5c07] Got older packet 
> >> (21845.466797): 48
> >> 2014-04-29 12:26:53.223 MyPlayer[197:5c07] PTS: 21845.466797(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.262 MyPlayer[197:5c07] Got older packet 
> >> (21884.378906): 49
> >> 2014-04-29 12:26:53.265 MyPlayer[197:5c07] PTS: 21884.378906(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.304 MyPlayer[197:5c07] Got older packet 
> >> (21924.312500): 50
> >> 2014-04-29 12:26:53.306 MyPlayer[197:5c07] PTS: 21924.312500(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.343 MyPlayer[197:5c07] Got older packet 
> >> (21965.599609): 51
> >> 2014-04-29 12:26:53.347 MyPlayer[197:5c07] PTS: 21965.599609(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:53.350 MyPlayer[197:5c07] Got older packet 
> >> (22004.466797): 52
> >> 2014-04-29 12:26:53.352 MyPlayer[197:5c07] PTS: 22004.466797(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.391 MyPlayer[197:5c07] Got older packet 
> >> (22043.710938): 53
> >> 2014-04-29 12:26:53.393 MyPlayer[197:5c07] PTS: 22043.710938(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.424 MyPlayer[197:5c07] Got older packet 
> >> (22084.667969): 54
> >> 2014-04-29 12:26:53.427 MyPlayer[197:5c07] PTS: 22084.667969(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.473 MyPlayer[197:5c07] Got older packet 
> >> (22124.066406): 55
> >> 2014-04-29 12:26:53.476 MyPlayer[197:5c07] PTS: 22124.066406(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.506 MyPlayer[197:5c07] Got older packet 
> >> (22164.800781): 56
> >> 2014-04-29 12:26:53.507 MyPlayer[197:5c07] PTS: 22164.800781(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.549 MyPlayer[197:5c07] Got older packet 
> >> (22205.644531): 57
> >> 2014-04-29 12:26:53.551 MyPlayer[197:5c07] PTS: 22205.644531(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.590 MyPlayer[197:5c07] Got older packet 
> >> (22244.023438): 58
> >> 2014-04-29 12:26:53.593 MyPlayer[197:5c07] PTS: 22244.023438(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.628 MyPlayer[197:5c07] Got older packet 
> >> (22283.644531): 59
> >> 2014-04-29 12:26:53.631 MyPlayer[197:5c07] PTS: 22283.644531(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.668 MyPlayer[197:5c07] PTS: 22324.710938(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.712 MyPlayer[197:5c07] PTS: 22364.267578(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.751 MyPlayer[197:5c07] PTS: 22404.044922(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.793 MyPlayer[197:5c07] PTS: 22444.888672(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.833 MyPlayer[197:5c07] PTS: 22484.511719(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.871 MyPlayer[197:5c07] PTS: 22524.289062(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.913 MyPlayer[197:5c07] PTS: 22565.177734(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.954 MyPlayer[197:5c07] PTS: 22604.734375(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:53.998 MyPlayer[197:5c07] PTS: 22644.023438(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.037 MyPlayer[197:5c07] PTS: 22685.244141(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.074 MyPlayer[197:5c07] PTS: 22724.599609(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.124 MyPlayer[197:5c07] PTS: 22764.044922(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.156 MyPlayer[197:5c07] PTS: 22804.490234(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.197 MyPlayer[197:5c07] PTS: 22844.156250(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.244 MyPlayer[197:5c07] PTS: 22884.023438(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.278 MyPlayer[197:5c07] PTS: 22923.511719(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.318 MyPlayer[197:5c07] PTS: 22964.177734(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.378 MyPlayer[197:5c07] PTS: 23004.445312(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.407 MyPlayer[197:5c07] PTS: 23044.111328(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.445 MyPlayer[197:5c07] PTS: 23084.378906(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.485 MyPlayer[197:5c07] PTS: 23124.000000(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.525 MyPlayer[197:5c07] PTS: 23164.066406(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.566 MyPlayer[197:5c07] PTS: 23204.623047(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.613 MyPlayer[197:5c07] PTS: 23243.734375(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.667 MyPlayer[197:5c07] PTS: 23283.888672(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.707 MyPlayer[197:5c07] PTS: 23323.089844(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.739 MyPlayer[197:5c07] PTS: 23364.355469(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.778 MyPlayer[197:5c07] PTS: 23403.623047(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.819 MyPlayer[197:5c07] PTS: 23444.734375(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.866 MyPlayer[197:5c07] PTS: 23484.044922(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.900 MyPlayer[197:5c07] PTS: 23524.111328(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.942 MyPlayer[197:5c07] PTS: 23564.957031(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:54.947 MyPlayer[197:5c07] PTS: 23603.957031(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:54.987 MyPlayer[197:5c07] PTS: 23643.134766(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.023 MyPlayer[197:5c07] PTS: 23684.333984(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.064 MyPlayer[197:5c07] PTS: 23723.156250(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.146 MyPlayer[197:5c07] PTS: 23762.867188(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:55.149 MyPlayer[197:5c07] PTS: 23807.623047(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.230 MyPlayer[197:5c07] PTS: 23882.867188(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.275 MyPlayer[197:5c07] PTS: 23923.667969(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.315 MyPlayer[197:5c07] PTS: 23963.623047(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.354 MyPlayer[197:5c07] PTS: 24003.556641(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.389 MyPlayer[197:5c07] PTS: 24044.333984(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.431 MyPlayer[197:5c07] PTS: 24083.466797(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.471 MyPlayer[197:5c07] PTS: 24123.822266(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.511 MyPlayer[197:5c07] PTS: 24165.177734(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.551 MyPlayer[197:5c07] PTS: 24204.000000(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.592 MyPlayer[197:5c07] PTS: 24243.466797(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.637 MyPlayer[197:5c07] PTS: 24284.333984(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.674 MyPlayer[197:5c07] PTS: 24323.845703(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.714 MyPlayer[197:5c07] PTS: 24363.111328(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.754 MyPlayer[197:5c07] PTS: 24404.490234(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.795 MyPlayer[197:5c07] PTS: 24447.066406(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.836 MyPlayer[197:5c07] PTS: 24482.511719(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.877 MyPlayer[197:5c07] PTS: 24524.023438(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.917 MyPlayer[197:5c07] PTS: 24563.400391(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.958 MyPlayer[197:5c07] PTS: 24602.644531(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:55.998 MyPlayer[197:5c07] PTS: 24643.355469(Duration : 
> >> 40.000000) Bufferred: 3640.00
> >> 2014-04-29 12:26:56.048 MyPlayer[197:5c07] PTS: 24682.978516(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> 2014-04-29 12:26:56.092 MyPlayer[197:5c07] PTS: 24722.644531(Duration : 
> >> 40.000000) Bufferred: 3600.00
> >> .
> >> .
> >> .
> >> .
> >> .
> >> 
> >> Is this expected/valid? How can we handle such cases? 
> > 
> > Yes, most file formats store the timestamp in a way that requires
> > reordering. If the decoder you're using doesn't provide any means to do
> > the reordering, you could sort them, I guess.
> > 
> >> Thanks and regards
> >> Abhishek
> >> 
> >> 
> >> On 30-Apr-2014, at 3:35 PM, wm4 <[email protected]> wrote:
> >> 
> >>> On Tue, 29 Apr 2014 12:13:01 -0700
> >>> J Decker <[email protected]> wrote:
> >>> 
> >>>> On Tue, Apr 29, 2014 at 3:26 AM, Abhishek Maniyar <
> >>>> [email protected]> wrote:
> >>>> 
> >>>>> Hello Everyone,
> >>>>> 
> >>>>> I am trying to connect to RTSP using FFMPEG library in iOS.
> >>>>> 
> >>>>> I am using TCP. Some times in poor network conditions, packets with 
> >>>>> older
> >>>>> PTS received. Is it possible in FFMPEG to get a packet with PTS is 
> >>>>> sequence
> >>>>> 10,11,12,13,7,8,9,….. Should FFMPEG not discard packets those are older 
> >>>>> den
> >>>>> current packet?
> >>>>> 
> >>>> I had the same sort of sequential PTS in some videos; another place to
> >>>> ignore that and use your own frame count based PTS... like MP4 clips come
> >>>> in ticks, mkv come in milliseconds in the PTS and some are sequential
> >>>> counts (avi)  and even playing from disk I got backwards numbers
> >>> 
> >>> Seems like you don't understand timestamps at all.
> >>> 
> >>> First, PTS can go backwards on the packet level. This is because some
> >>> codecs reorder frames on decoding. Packet PTS are in encoded order, not
> >>> in display order, and the decoder will reorder the PTS to display order
> >>> for you (just like it reorders the decoded pictures). See AVFrame
> >>> fields for more info.
> >>> 
> >>> Second, timestamps in ffmpeg are always relative to a timebase. The
> >>> timebase tells you in what units the PTS values are in. You just divide
> >>> the PTS by the timebase, and you get the time in seconds. The
> >>> demuxer will tell you the timebase; see AVStream.time_base.
> >>> _______________________________________________
> >>> Libav-user mailing list
> >>> [email protected]
> >>> http://ffmpeg.org/mailman/listinfo/libav-user
> >> 
> >> 
> > 
> > _______________________________________________
> > Libav-user mailing list
> > [email protected]
> > http://ffmpeg.org/mailman/listinfo/libav-user
> 

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to