[Libav-user] understanding AVPackets and AVFrames

Maziar Mehrabi maziar.mehrabi at gmail.com
Thu Dec 11 20:58:16 CET 2014


Hi,

How do you decode your frames? If you wanna know when decoding of a frame
is finished why not using int *got_picture_ptr which gets modified
(returns) by avcodec_decode_video2?

Regards,
Maziar Mehrabi


--
Hälsningar,
Maziar Mehrabi,

On Wed, Dec 10, 2014 at 10:50 AM, Alina lifshits <alina at vicon.co.il> wrote:

> Hello,
>
>
>
> I am decoding h264 live stream (I-Frames & P-Frames only) and the
> FF_THREAD_FRAME flag is turned off to keep small latency.
>
>
>
> In my app I need to know exactly when an AVPacket is decoded and produces
> an AVFrame. To do so I am using the AVFrame.pkt_pts and AVFrame.pkt_dts
> fields to find the AVPacket this frame was produced of. Most of the time
> everything works as expected. Each AVPacket input produces AVFrame output
> and the fields are matching. But I do have a stream when the behavior is
> different:
>
> The first frame: AVPacket1  à  AVFrame1 and all is OK. The resulting
> AVFrame1.ptk_pts == AVPacket1.pts and AVFrame1.ptk_dts == AVPacket1.dts and
> the produced frame is an I_FRAME.
>
> The second frame: AVPacket2  à  AVFrame2. The resulting AVFrame2.pkt_dts
> == AVPacket2.dts BUT AVFrame2.pkt_pts != AVPacket2.pts, instead
> AVFrame2.pkt_pts == AVPacket1.pts!!!! and the produced frame is again an
> I_FRAME.  The is unexpected, the second frame should be a P-FRAME
> (according to the h264 stream) and now I cannot tell for sure that the
> second AVFrame2 was produced from AVPacker2. Was it? Or the decoder returns
> twice the same frame?
>
>
>
> My main questions is if using the pkt_pts & pkt_dts is the right solution
> for me? Is there a most reliable way to do it?
>
>
>
>
>
> Many thanks,
>
> Alina
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141211/0be93332/attachment.html>


More information about the Libav-user mailing list