On Wed, 2010-05-26 at 17:37 -0300, Gnu Dev wrote:
> Hi,
>
> I encoded a file .avi to .flv and work OK, pkt.pts is 33, 67, 100, 133.....
>
> But when I try to re-encode a .flv to .flv , pkt.pts is 1,2,3,4,5 and the
> disply is very fast.
>
> The portion os code is :
>
> res = avcodec_encode_video(c, pkt.data, pkt.size, frame);
>
> if (c->coded_frame->pts != AV_NOPTS_VALUE) {
>
> pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base,
> ctx->streams[0]->time_base);
> }
>
> Can some helpme to set correct pts on .flv?
>
> Thanks.You should uses the timestamps given by the demuxer. Unless the encoder does B-frames this should work well enough (if not you'll have to reorder the demuxed timestamps in the same fashion as the encoder did). coded_frame->pts contains synthetic values. What you should do is rescale from the input stream's time base to the output stream's time base. Something like: pkt.pts = av_rescale_q(inpkt.pts, inctx->streams[0]->time_base, ctx->streams[0]->time_base); In the case of flv -> flv the time bases are probably the same (1 kHz), but it's a good idea to do this anyway. The reason for this is that flv has variable frame rate. I've had files with initial time stamps like 0, 333, 666, 1000, 1033, 1066, 1100.. /Tomas
signature.asc
Description: This is a digitally signed message part
_______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
