[Libav-user] FFMpeg Question about paket pts, dts and duration parameters

Denis Gottardello info at denisgottardello.it
Tue Apr 28 17:57:13 EEST 2020


Hi, after having implemented the remuxing.c example my program works with file to file but not with rtsp camera to file.
I think that the problem is related to the following lines of code:

/Packet.pts= av_rescale_q_rnd(Packet.pts, pAVStreamIn->time_base, pAVStreamOut->time_base, static_cast<AVRounding>(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));/
/Packet.dts= av_rescale_q_rnd(Packet.dts, pAVStreamIn->time_base, pAVStreamOut->time_base, static_cast<AVRounding>(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));/
/Packet.duration= av_rescale_q(Packet.duration, pAVStreamIn->time_base, pAVStreamOut->time_base);/

The code works with file to file but not using an rtsp camera as source to file. I obtain an error at av_interleaved_write_frame function. Please have a look at the following log report: 

AudioIndex Packet.pts: 0, Packet.dts: 0, Packet.duration: 160
AudioIndex Packet.pts: 120, Packet.dts: 120, Packet.duration: 160  
AudioIndex Packet.pts: 312, Packet.dts: 312, Packet.duration: 160
AudioIndex Packet.pts: 432, Packet.dts: 432, Packet.duration: 160
AudioIndex Packet.pts: 632, Packet.dts: 632, Packet.duration: 160
AudioIndex Packet.pts: 752, Packet.dts: 752, Packet.duration: 160
AudioIndex Packet.pts: 952, Packet.dts: 952, Packet.duration: 160
AudioIndex Packet.pts: 1072, Packet.dts: 1072, Packet.duration: 160
AudioIndex Packet.pts: 1272, Packet.dts: 1272, Packet.duration: 160
AudioIndex Packet.pts: 1392, Packet.dts: 1392, Packet.duration: 160
AudioIndex Packet.pts: 1592, Packet.dts: 1592, Packet.duration: 160
AudioIndex Packet.pts: 1712, Packet.dts: 1712, Packet.duration: 160
*VideoIndex Packet.pts: 9223372036854775808, Packet.dts: 9223372036854775808, Packet.duration: 0*

As you can see the pts, dts and duration parameters relative to audio stream is ok, the video parameters abolutally not. How can I do to rewrite the video parameters? Can anyone explain?
How can I calculate pts and dts using current time stamp?
Have you got a example for me?
I have tryed in this way but does not work
*Packet.pts= Packet.dts= VideoPacketNumber++;*
Many thanks.


+39.347.4070897
http://www.labcsp.com[1]
http://www.denisgottardello.it[2]
GMT+1
Skype: mrdebug

--------
[1] http://www.labcsp.com
[2] http://www.denisgottardello.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200428/8ce4a57c/attachment.html>


More information about the Libav-user mailing list