MtTracer schrieb:
> Andre schrieb:
>> Obviously, the pts values are jumping around and sometimes they are actually
>> before the dts values, which really is no good  ;)
>>
> I think you are setting the pts values wrong. As I understood the 
> reordering of packets AND frames is done completely by libav itself. 

That's now also my opinion.

> For example if the frames are in this order in presentation time:
> 1 2 3 4 5 6 7 ...
> I B B P B B P ...
> 
> av_read_frame will return them in different order because the B frames 
> need the following P frame decoded before them:
> 1 4 2 3 7 5 6 ...
> I P B B P B B ...

The reordering of frames in the stream was already clear to me but I thought
when requesting frames, av_read_frame would return the presentation order and
not the decoding order. A quite silly assumption, though...

> So if you set the frames pts to the packets one you used frame 4 will 
> get pts of frame 7 and every following P or I frame will get wrong pts 
> values too.

Sounds reasonable.

> I solved this by simply saving the packet's pts if got_picture_ptr is 0 
> and for every following frame I check if savedPTS<packetPTS. In this 
> case I use the saved pts instead and the packet's pts will be saved then.

I'll give it a try. Thank you for the quick and exhaustive answer!

Regards,
 Andre
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to