bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.51k stars 1.58k forks source link

Java BufferedImage to Mat #1985

Closed kono94 closed 1 year ago

kono94 commented 1 year ago

Hello, sorry for issue, I know there are similar issues closed like https://github.com/bytedeco/javacv/issues/888 or https://github.com/bytedeco/javacv/issues/1601 , but none of those solution works on my end.

I tried to use the raw byte[] of an intern representation of an image captured from a stream, using: Mat mat = new Mat(img.getHeight(), img.getWidth(), CV_8UC3, new BytePointer(img.getPixel())); , but this results in a weird result like this:

Fortunately, the underlying SDK offers a fully converted BufferedImage, internally doing somthing like this:

DataBufferByte buffer = new DataBufferByte(img.getPixel(), img.getPixel().length);

        int[] bandOffsets = {2, 1, 0};

        WritableRaster raster = Raster.createInterleavedRaster(buffer, img.getWidth(), img.getHeight(), img.getStride(), 3, bandOffsets, null);

        ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);

        ComponentColorModel ccm = new ComponentColorModel(sRGB, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);

        BufferedImage image = new BufferedImage(ccm, raster, false, null); 

Using imdecode(): imdecode(new Mat(new BytePointer(data), false), IMREAD_COLOR); results in an error while displaying the Mat with imshow(), Unrecognized or unsupported array type in function 'cvGetMat'

Doing it explicitly works, but takes more than 50ms, so this is unusable:

 public Mat bufferedImageToMat(BufferedImage bi, boolean placeholder) {
        Mat mat = new Mat(bi.getHeight(), bi.getWidth(), CV_8UC(3));

        int r, g, b;
        UByteRawIndexer indexer = mat.createIndexer();
        for (int y = 0; y < bi.getHeight(); y++) {
            for (int x = 0; x < bi.getWidth(); x++) {
                int rgb = bi.getRGB(x, y);

                r = (byte) ((rgb >> 0) & 0xFF);
                g = (byte) ((rgb >> 8) & 0xFF);
                b = (byte) ((rgb >> 16) & 0xFF);

                indexer.put(y, x, 0, r);
                indexer.put(y, x, 1, g);
                indexer.put(y, x, 2, b);
            }
        }
        indexer.release();
        return mat;
    }

Is there any chance to fastly convert the raw byte[] or the underlying byte[] from the BufferedImage, byte[] data = ((DataBufferByte) bi.getRaster().getDataBuffer()).getData(); to a correctly looking Mat?

Thanks in advance!

saudet commented 1 year ago

Please try to use Java2DFrameConverter instead.

kono94 commented 1 year ago

Yes, this works.

However, this call takes 22-40ms:

 OpenCVFrameConverter.ToMat cv = new OpenCVFrameConverter.ToMat();
        return cv.convertToMat(new Java2DFrameConverter().convert(bi));

Off-topic (should I move it to another issue?): I am in this situation in the first place because the FFMPEGGrabber from JavaCV adds a constant delay of ~2 seconds when grabbing frames from an RSTP/IP camera and an internal C++ SDK with a Java wrapper which uses FFMPEG under the hood as well, offers the BufferedImages in Java almost at zero latency. Maybe this is a bug in the implementation of the FFMPEGGrabber class? I also tried a variety of different options and hardware accelerated decoding using cuvid:

        fGrabber.setOption("rtsp_transport", "tcp");
        fGrabber.setOption("fflags", "nobuffer");
        fGrabber.setOption("tune", "zerolatency");
        fGrabber.setOption("preset", "ultrafast");
        fGrabber.setOption("avioflags", "+direct");
       fGrabber.setOption("an", "");
      fGrabber.setOption("threads", "1");

The result stays the same, 2 seconds delay. For testing purposes, if I print out the pixel values from the grabbed Frame from the very top left pixel and then abruptly put a white paper in front of the camera, the values are changing with a constant 2 seconds delay. At first, we thought, this delay is due to our processing pipeline and encoding the Mats with H.264 to RTMP, sending it to a MediaServer to serve WebRTC and displaying it in the browser. But after using the internal C++ SDK, this whole pipeline has less than 1 second latency.

What am I doing wrong, or is this common and expected behavior?

saudet commented 1 year ago

However, this call takes 22-40ms:

Create OpenCVFrameConverter and Java2DFrameConverter only once and it will be faster.

What am I doing wrong, or is this common and expected behavior?

It's probably some option somewhere, yes. Please make sure that FFmpegLogCallback.set() has been called.

kono94 commented 1 year ago

Oh, thank you very much. Will try it out!

kono94 commented 1 year ago

Create OpenCVFrameConverter and Java2DFrameConverter only once and it will be faster.

Extracting it to member variables was unnoticeable, maybe 1 ms faster.

It's probably some option somewhere, yes. Please make sure that FFmpegLogCallback.set() has been called.

Still 2 seconds delay. I also got the feeling that the different options make no difference as well.

  FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("rtsp://...");
        grabber.setOption("rtsp_transport", "tcp");
          // grabber.setOption("hwaccel", "cuvid");
        //grabber.setOption("fflags", "nobuffer");
       // grabber.setOption("tune", "zerolatency");
       // grabber.setOption("preset", "ultrafast");
       // grabber.setOption("avioflags", "+direct");
      //  grabber.setOption("an", "");
      //  grabber.setOption("threads", "1");

        FFmpegLogCallback.set();

        (...)
         while ((grabbedImage = grabber.grab()) != null) {
            Mat mat = converter.convertToMat(grabbedImage);
            if (mat != null && null != grabbedImage.image[0]) {
                imshow("Test", mat);
                waitKey(1);
            }
        }

Using all those options, Cuvid or UDP makes no difference, still >= 2 seconds delay :(

saudet commented 1 year ago

And what are the messages in the log from FFmpeg?

kono94 commented 1 year ago

Debug: Probing rtsp score:100 size:0

Debug: [tcp @ 0x7fd60159ecc0] No default whitelist set

Debug: [tcp @ 0x7fd60159ecc0] Original list of addresses:

Debug: [tcp @ 0x7fd60159ecc0] Address 192.168.0.101 port 554

Debug: [tcp @ 0x7fd60159ecc0] Interleaved list of addresses:

Debug: [tcp @ 0x7fd60159ecc0] Address 192.168.0.101 port 554

Debug: [tcp @ 0x7fd60159ecc0] Starting connection attempt to 192.168.0.101 port 554

Debug: [tcp @ 0x7fd60159ecc0] Successfully connected to 192.168.0.101 port 554

Debug: [rtsp @ 0x7fd60159ca40] Sending: OPTIONS rtsp://192.168.0.101:554/Streaming/channels/101 RTSP/1.0 CSeq: 1 User-Agent: Lavf59.16.100

--

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='RTSP/1.0 200 OK'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Date: Sat, Jan 24 1970 01:38:43 GMT'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line=''

Debug: [rtsp @ 0x7fd60159ca40] Sending: DESCRIBE rtsp://192.168.0.101:554/Streaming/channels/101 RTSP/1.0 Accept: application/sdp CSeq: 2 User-Agent: Lavf59.16.100

--

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='RTSP/1.0 401 Unauthorized'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='CSeq: 2'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='WWW-Authenticate: Digest realm="IP Camera(K3230)", nonce="25641b03c6c08604db9787144feb3552", stale="FALSE"'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Date: Sat, Jan 24 1970 01:38:43 GMT'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line=''

Debug: [rtsp @ 0x7fd60159ca40] Sending: DESCRIBE rtsp://192.168.0.101:554/Streaming/channels/101 RTSP/1.0 Accept: application/sdp CSeq: 3 User-Agent: Lavf59.16.100 Authorization: Digest username="admin", realm="IP Camera(K3230)", nonce="25641b03c6c08604db9787144feb3552", uri="rtsp://192.168.0.101:554/Streaming/channels/101", response="9fcaf1e9bf2a2cc47fddd121492cc529"

--

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='RTSP/1.0 200 OK'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='CSeq: 3'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Content-Type: application/sdp'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Content-Base: rtsp://192.168.0.101:554/Streaming/channels/101/'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Content-Length: 599'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line=''

Debug: [rtsp @ 0x7fd60159ca40] SDP: v=0 o=- 1993123568441 1993123568441 IN IP4 192.168.0.101 s=Media Presentation e=NONE b=AS:5050 t=0 0 a=control:rtsp://192.168.0.101:554/Streaming/channels/101/ m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:5000 a=recvonly a=x-dimensions:1280,720 a=control:rtsp://192.168.0.101:554/Streaming/channels/101/trackID=1 a=rtpmap:96 H264/90000 a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AM4qKUCgC3f+AAIAAtkAAAPoAADDUAQ==,aO48gA== a=Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000; a=appversion:1.0

Debug: [rtsp @ 0x7fd60159ca40] sdp: v='0'

Debug: [rtsp @ 0x7fd60159ca40] sdp: o='- 1993123568441 1993123568441 IN IP4 192.168.0.101'

Debug: [rtsp @ 0x7fd60159ca40] sdp: s='Media Presentation'

Debug: [rtsp @ 0x7fd60159ca40] sdp: e='NONE'

Debug: [rtsp @ 0x7fd60159ca40] sdp: b='AS:5050'

Debug: [rtsp @ 0x7fd60159ca40] sdp: t='0 0'

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='control:rtsp://192.168.0.101:554/Streaming/channels/101/'

Debug: [rtsp @ 0x7fd60159ca40] sdp: m='video 0 RTP/AVP 96'

Debug: [rtsp @ 0x7fd60159ca40] sdp: c='IN IP4 0.0.0.0'

Debug: [rtsp @ 0x7fd60159ca40] sdp: b='AS:5000'

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='recvonly'

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='x-dimensions:1280,720'

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='control:rtsp://192.168.0.101:554/Streaming/channels/101/trackID=1'

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='rtpmap:96 H264/90000'

Debug: [rtsp @ 0x7fd60159ca40] video codec set to: h264

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AM4qKUCgC3f+AAIAAtkAAAPoAADDUAQ==,aO48gA=='

Debug: [rtsp @ 0x7fd60159ca40] RTP Profile IDC: 42 Profile IOP: 0 Level: 29

Debug: [rtsp @ 0x7fd60159ca40] RTP Packetization Mode: 1

Debug: [rtsp @ 0x7fd60159ca40] Extradata set to 0x7fd60159e160 (size: 37)

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000;'

Debug: [rtsp @ 0x7fd60159ca40] sdp: a='appversion:1.0'

Debug: [rtsp @ 0x7fd60159ca40] Sending: SETUP rtsp://192.168.0.101:554/Streaming/channels/101/trackID=1 RTSP/1.0 Transport: RTP/AVP/TCP;unicast;interleaved=0-1 CSeq: 4 User-Agent: Lavf59.16.100 Authorization: Digest username="admin", realm="IP Camera(K3230)", nonce="25641b03c6c08604db9787144feb3552", uri="rtsp://192.168.0.101:554/Streaming/channels/101/trackID=1", response="c7bbadc68430d85f5a3cf8f3fc9ddbf2"

--

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='RTSP/1.0 200 OK'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='CSeq: 4'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Session: 1164274257;timeout=60'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=0e9aa4f6;mode="play"'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Date: Sat, Jan 24 1970 01:38:43 GMT'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line=''

Debug: [rtsp @ 0x7fd60159ca40] setting jitter buffer size to 0

Debug: [rtsp @ 0x7fd60159ca40] hello state=0

Debug: [rtsp @ 0x7fd60159ca40] Sending: PLAY rtsp://192.168.0.101:554/Streaming/channels/101/ RTSP/1.0 Range: npt=0.000- CSeq: 5 User-Agent: Lavf59.16.100 Session: 1164274257 Authorization: Digest username="admin", realm="IP Camera(K3230)", nonce="25641b03c6c08604db9787144feb3552", uri="rtsp://192.168.0.101:554/Streaming/channels/101/", response="b24e161d83a89fd48d47446e1fa36c48"

--

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='RTSP/1.0 200 OK'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='CSeq: 5'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Session: 1164274257'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='RTP-Info: url=rtsp://192.168.0.101:554/Streaming/channels/101/trackID=1;seq=31001;rtptime=621553978'

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line='Date: Sat, Jan 24 1970 01:38:43 GMT'

]

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=0a [ ]

Debug: [rtsp @ 0x7fd60159ca40] line=''

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 7(SPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 8(PPS), nal_ref_idc: 3

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=40

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 7(SPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 8(PPS), nal_ref_idc: 3

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=16

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=652

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=84

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 7(SPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 8(PPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 5(IDR), nal_ref_idc: 3

Debug: [h264 @ 0x7fd60159ddc0] Format yuvj420p chosen by get_format().

Debug: [h264 @ 0x7fd60159ddc0] Reinit context to 1280x720, pix_fmt: yuvj420p

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=84

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=100

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=108

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=128

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=120

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=116

Debug: [h264 @ 0x7fd60159ddc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=164

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=172

Debug: [rtsp @ 0x7fd60159ca40] first_dts 25200 not matching first dts NOPTS (pts NOPTS, duration 3600) in the queue

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=124

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=148

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=156

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=148

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=148

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=120

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=136

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=108

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=100

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=108

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=96

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=100

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=100

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=72

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=108

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=80

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=104

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=104

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=124

Debug: [rtsp @ 0x7fd60159ca40] All info found

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.500000 0.015874

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.583333 0.011414

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.583333 0.011414

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.666667 0.007690

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.666667 0.007690

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.750000 0.004702

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.750000 0.004702

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.833333 0.002450

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.833333 0.002450

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.916667 0.000934

Debug: [rtsp @ 0x7fd60159ca40] rfps: 24.916667 0.000934

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.000000 0.000155

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.083333 0.000111

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.083333 0.000111

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.166667 0.000804

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.166667 0.000804

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.250000 0.002233

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.250000 0.002233

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.333333 0.004398

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.333333 0.004398

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.416667 0.007299

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.416667 0.007299

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.500000 0.010936

Debug: [rtsp @ 0x7fd60159ca40] rfps: 25.583333 0.015310

Debug: [rtsp @ 0x7fd60159ca40] rfps: 50.000000 0.000619

Debug: [rtsp @ 0x7fd60159ca40] stream 0: start_time: 0.04 duration: NOPTS

Debug: [rtsp @ 0x7fd60159ca40] format: start_time: 0.04 duration: NOPTS (estimate from bit rate) bitrate=0 kb/s

Info: Input #0, rtsp, from 'rtsp://XXXXXX@192.168.0.101/Streaming/channels/101':

Info: Metadata:

Info: title : Info: Media Presentation Info:

Info: Duration: Info: N/A Info: , start: Info: 0.040000 Info: , bitrate: Info: N/A Info:

Info: Stream #0:0 Debug: , 28, 1/90000 Info: : Video: h264 (Main), 1 reference frame, yuvj420p(pc, progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 0/1 Info: , Info: 25 fps, Info: 25.08 tbr, Info: 90k tbn Info:

Debug: detected 16 logical cores

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 7(SPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 8(PPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 7(SPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 8(PPS), nal_ref_idc: 3

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 5(IDR), nal_ref_idc: 3

Debug: [h264 @ 0x7fd6015a8880] Format yuvj420p chosen by get_format().

Debug: [h264 @ 0x7fd6015a8880] Reinit context to 1280x720, pix_fmt: yuvj420p

Debug: [h264 @ 0x7fd601049540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd60226b8c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd6027c5ec0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd6027da540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd602230340] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd6022449c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd602259040] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd600f30d80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd600f445c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd601d40880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd601d4f200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd601d63880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd601d64200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd601d78880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd601d8cf00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd60146cac0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601049540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd60226b8c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6027c5ec0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380e05100] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6027da540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd602230340] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [h264 @ 0x7fd6022449c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd602259040] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd600f30d80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd600f445c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601d40880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601d4f200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=120

Debug: [h264 @ 0x7fd601d63880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddad40] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=132

Debug: [h264 @ 0x7fd601d64200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=112

Debug: [h264 @ 0x7fd601d78880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=120

Debug: [h264 @ 0x7fd601d8cf00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=128

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=136

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601049540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=164

Debug: [h264 @ 0x7fd60226b8c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=116

Warning: [swscaler @ 0x7fd380dcdd80] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6027c5ec0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=116

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6027da540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=120

Debug: [h264 @ 0x7fd602230340] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=96

Debug: [h264 @ 0x7fd6022449c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=120

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd602259040] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=128

Debug: [h264 @ 0x7fd600f30d80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=100

Debug: [h264 @ 0x7fd600f445c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=88

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601d40880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=92

Debug: [h264 @ 0x7fd601d4f200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=76

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601d63880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=76

Debug: [h264 @ 0x7fd601d64200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=72

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601d78880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=64

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd601d8cf00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=76

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [h264 @ 0x7fd6015a8880] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=40

Debug: [h264 @ 0x7fd601049540] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1

Warning: [swscaler @ 0x7fd380ddd5c0] deprecated pixel format used, make sure you did set range correctly

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=16

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

Debug: [rtsp @ 0x7fd60159ca40] tcp_read_packet:

Debug: [rtsp @ 0x7fd60159ca40] ret=1 c=24 [$]

Debug: [rtsp @ 0x7fd60159ca40] id=0 len=1440

saudet commented 1 year ago

Debug: [rtsp @ 0x7fd60159ca40] line='RTSP/1.0 401 Unauthorized'

That reminds me of some other issue that was posted here a while ago. The problem was something about FFmpeg stalling on errors like this, while VLC wasn't. We need to patch FFmpeg to work around those kinds of issues. Please report upstream!

kono94 commented 1 year ago

Okay. In Python, OpenCV with GStreamer is latency free, so it really seems like FFMPEG is the problem here.

When I am using JavaCV, does it use the system's openCV or a pre-compiled version?

In short, I want to use GStreamer with JavaCV like this:

     var gstString = "rtspsrc location=rtsp://XXXX latency=0 ! decodebin ! videoconvert ! video/x-raw,format=BGR ! appsink drop=1";
        var cap = new VideoCapture(gstString, CAP_GSTREAMER);

How do I check if GStreamer support is present, is there an equivalent to Python's cv2.getBuildInformation() ?

saudet commented 1 year ago

You can build OpenCV with GStreamer, sure: https://github.com/bytedeco/javacpp-presets#build-instructions

saudet commented 1 year ago

To make JavaCPP try to load the version of OpenCV from your system first, you can set the "org.bytedeco.javacpp.pathsFirst" system property to "true": http://bytedeco.org/javacpp/apidocs/org/bytedeco/javacpp/Loader.html#load-java.lang.Class-java.util.Properties-boolean- http://bytedeco.org/javacpp/apidocs/org/bytedeco/javacpp/Loader.html#pathsFirst

saudet commented 1 year ago

The C++ API of OpenCV has a getBuildInformation() function too, yes: http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/opencv/global/opencv_core.html#getBuildInformation--

kono94 commented 1 year ago

Thanks for all your help.

In the end, I was able to build opencv-platform with full GStreamer and GPU support (maven is an insane tool :D). The GStreamer pipelines for de- and encoding work very well, no latency at all, and even doing inference and sending it to a media server (OvenMediaEngine) and serving it as WebRTC stream, the delay is very small (<500ms)!

No hassle converting any BufferedImages or stuff like this.

Very grateful for the whole project and the work you put into it! (My friend and me referring to you as the "Java/ Video Processing/ Deep Learning/ JNI God", working with JavaCPP for more than 6 months now)