[FFmpeg-user] Camera's pts and dts jumps issue

tilzaer ipotapev at gmail.com
Fri Mar 14 08:00:55 CET 2014

I use ffmpeg library in my code for capturing rtsp streams from cameras and
writing in flv. If I capture streams from only one camera and camera has
only video stream then there's no any errors, I got first packet with pts
and dts 1698557894 and other packets' pts and dts slowly increases. But if
camera has video and audio streams, then strange things occur. For example,
video packets pts and dts begin with 1698557894 and slowly increase, and
audio starts with 0 then slowly increases and after ~50 packets jumps to
value 151004317 and slowly increase. Another situation, when audio begins
with 0 and slowly increases, and video begins from 1785662594 and after ~70
packets jumps to 234722 and slowly increase. Such behaviour do not allow flv
segment muxer to write files, it just returns some EINVAL value.

Also if I try to capture streams from two cameras, first camera has only
video and another has video and audio, then first camera packets' pts and
dts are ok. But another camera has video and audio pts/dts values which are
very different. av_read_frame returns video packet with pts/dts value
1811924055, which rescales to 557003451 in flv muxer and audio 4456027604,
which rescales to 557003451, but these values must be almost equal!

So, the questions are:
0) why do these jumps occur in the beginning of capturing? is it a problem
with camera or it is just some ffmpeg issue?
1) can such jump occur after some long period? how I should handle it?
2) why camera's video and audio have so different pts/dts values?

View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Camera-s-pts-and-dts-jumps-issue-tp4664353.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.

More information about the ffmpeg-user mailing list