1
votes

Trying to correctly grab via FFmpeg an IP camera, Hikvision brand.

That is what going on with FFmpeg:

        "ffmpeg",
        "-rtsp_transport", "tcp",
        "-stimeout", "3000000",
        "-re",
        "-i", stream,
        "-vcodec", "copy",
        "-acodec", "libfdk_aac",
        "-f", "segment",
        "-segment_list_type", "m3u8",
        "-segment_list", name,
        "-segment_list_size", "1",
        "-segment_format", "mpegts",
        "-segment_time", "5",
         segment_filename,

The result is always with these warning:

[segment @ 0x560d0df9d1e0] Non-monotonous DTS in output stream 0:0; previous: 33976, current: 7200; changing to 33977. This may result in incorrect timestamps in the output file.

I am stuck with these warnings, don't know how to get them away without re-encoding the stream. Indeed that is spoiling my timestamps.

1

1 Answers

1
votes

I am guessing that your camera doesn't implement RTCP (sender report correctly).

RTP is about the media streams. RTSP is the control protocol setting up the connection. RTCP is the sender report.

RTCP generates the correct timestamp from the wall clock and the RTP timestamps. More than once I have seen incorrect of missing RTCP implementation.

Use Wireshark to verify that your camera gives you correct timestamp or run Live555 in a debugger.