[Libav-user] Generated H264 video is only 1 second long with only 1 frame shown (Probably a PTS/DTS problem)
Charles
linux2 at orion15.org
Fri Sep 23 21:57:44 EEST 2016
On 09/21/2016 03:23 PM, M N wrote:
> Hi,
>so I guess it is a PTS problem. How do I set the PTS/DTS for a packet in H264?
[...]
>
> //pktr->pts = av_rescale_q_rnd(pkts->pts, ps->streams[pkts->stream_index]->time_base, ps2->streams[pkts->stream_index]->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
> //pktr->dts = av_rescale_q_rnd(pkts->dts, ps->streams[pkts->stream_index]->time_base, ps2->streams[pkts->stream_index]->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
> //pktr->duration = av_rescale_q(pkts->duration, ps->streams[pkts->stream_index]->time_base, ps->streams[pkts->stream_index]->time_base);
> //decoding
> pktr->stream_index = pkts->stream_index;
If the parameters are right...
pktr == output packet
ps->streams[pkts->stream_index]->time_base == in stream
ps2->streams[ stream_index ]->time_base == out stream
av_packet_rescale_ts( pktr, ps->streams[pkts->stream_index]->time_base, ps2->streams[ stream_index ]->time_base );
Thanks
cco
More information about the Libav-user
mailing list