[FFmpeg-user] FFMPEG can not open tcp rstp stream. Nonmatching transport in server reply. Other viewers fine.

Brandon Glatz brandon at brandonglatz.com
Sat Dec 10 13:54:53 EET 2016


FFMPEG can not open a tcp rstp stream. Nonmatching transport in server
reply. Other viewers fine.



Just spent my entire weekend on this, still not working, I know >what< the
problem is but not >why<

Bought some ultra cheap ptz cams from china (spare me the lecture, I know
the quality and other things can connect fine) and plan to use them with
zoneminder. Zoneminder uses ffmpeg to read these as they do not work with
the built in rtsp. Fine. In ffmpeg however, then run UDP, which after a
good portion of a day messing with seems to just not work with ffmpeg
reliably. I switched it to tcp, but it wouldn't connect.

Hours of messing around later and running ffmpeg on my machine locally, I
am to the point where I can open the tcp stream from other software totally
fine, however ffmpeg just will not open it and complains about a
Nonmatching transport.  After exhausing google, I figured up wireshark to
see what the heck is going on.

The results is captures from ffmpeg, vlc, and a third party rtsp viewer are
look identical. Here is a screenshot of the captures side-by-side:
http://img.superunicorn.net/i/cwzrmk.png

Here is the text of the packets:

******FFMPEG

    SETUP rtsp://10.0.0.110:554/onvif1/track1 RTSP/1.0
    Transport: RTP/AVP/TCP;unicast;interleaved=0-1
    CSeq: 3
    User-Agent: Lavf55.48.101


    RTSP/1.0 200 OK
    CSeq: 3
    Transport:
RTP/AVP;unicast;destination=192.168.1.90;source=10.0.0.110;interleaved=0-1
    Session: 1dbd7430;timeout=60


******VLC

    SETUP rtsp://10.0.0.110:554/onvif1/track1 RTSP/1.0
    CSeq: 4
    User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
    Transport: RTP/AVP/TCP;unicast;interleaved=0-1

    RTSP/1.0 200 OK
    CSeq: 4
    Transport:
RTP/AVP;unicast;destination=192.168.1.90;source=10.0.0.110;interleaved=0-1
    Session: 729e991b;timeout=60

    SETUP rtsp://10.0.0.110:554/onvif1/track2 RTSP/1.0
    CSeq: 5
    User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
    Transport: RTP/AVP/TCP;unicast;interleaved=2-3
    Session: 729e991b

    RTSP/1.0 200 OK
    CSeq: 5
    Transport:
RTP/AVP;unicast;destination=192.168.1.90;source=10.0.0.110;interleaved=2-3
    Session: 729e991b;timeout=60

    PLAY rtsp://10.0.0.110:554/onvif1 RTSP/1.0
    CSeq: 6
    User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
    Session: 729e991b
    Range: npt=0.000-

    RTSP/1.0 200 OK


******RTSP Viewer

    SETUP rtsp://10.0.0.110:554/onvif1/track1 RTSP/1.0
    CSeq: 3
    Transport: RTP/AVP/TCP;unicast;interleaved=0-1
    User-Agent: happytimesoft rtsp client

    RTSP/1.0 200 OK
    CSeq: 3
    Transport:
RTP/AVP;unicast;destination=192.168.1.90;source=10.0.0.110;interleaved=0-1
    Session: 160f5956;timeout=60

    SETUP rtsp://10.0.0.110:554/onvif1/track2 RTSP/1.0
    CSeq: 4
    Session: 160f5956
    Transport: RTP/AVP/TCP;unicast;interleaved=2-3
    User-Agent: happytimesoft rtsp client

    RTSP/1.0 200 OK
    CSeq: 4
    Transport:
RTP/AVP;unicast;destination=192.168.1.90;source=10.0.0.110;interleaved=2-3
    Session: 160f5956;timeout=60

    PLAY rtsp://10.0.0.110:554/onvif1 RTSP/1.0
    CSeq: 5
    Session: 160f5956
    Range: npt=0.0-
    User-Agent: happytimesoft rtsp client

    RTSP/1.0 200 OK


As you can see, ffmpeg stops after sending the setup command. Here is the
console output of ffmpeg as a screenshot:
http://img.superunicorn.net/i/kghotz.png

and as text:

    F:\User\Documents\ffmpeg\bin>ffmpeg -f rtsp -rtsp_transport tcp -i
"rtsp://10.0.0.110:554/onvif1"
    ffmpeg version N-64870-g135b1a3 Copyright (c) 2000-2014 the FFmpeg
developers
      built on Jul 21 2014 22:09:49 with gcc 4.8.3 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls -
    -enable-iconv --enable-libass --enable-libbluray --enable-libbs2b
--enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --
    enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable
    -libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvidstab --enable-libvo-aacenc
--enable-libvo-amrwben
    c --enable-libvorbis --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs
--enable-libxvid --enable-deck
    link --enable-zlib
      libavutil      52. 92.101 / 52. 92.101
      libavcodec     55. 69.100 / 55. 69.100
      libavformat    55. 48.101 / 55. 48.101
      libavdevice    55. 13.102 / 55. 13.102
      libavfilter     4. 11.102 /  4. 11.102
      libswscale      2.  6.100 /  2.  6.100
      libswresample   0. 19.100 /  0. 19.100
      libpostproc    52.  3.100 / 52.  3.100
    [rtsp @ 0000000000310820] Nonmatching transport in server reply
    rtsp://10.0.0.110:554/onvif1: Invalid data found when processing input


Looking around on google, there seems to be a lot of results for that error
but nothing that really explains /why/ that could be happening. Comparing
the request ffmpeg sent with the reply, they are exactly the same as what
was requested and the same as what the other programs requested:
http://img.superunicorn.net/i/hmgegt.png




I looked at the source for ffmpeg to see the relavent lines generating that
error to try and understand what exactly it might be having problems with,
but I do not quite understand what that is checking.

    /* Fail if the server responded with another lower transport mode
     * than what we requested. */
    if (reply->transports[0].lower_transport != lower_transport) {
        av_log(s, AV_LOG_ERROR, "Nonmatching transport in server reply\n");
        err = AVERROR_INVALIDDATA;
        goto fail;
    }


I assume that is checking that it offers what ffmpeg requests, which from
the above screenshot seems to be the case?

I have been stuck here for a few hours now and have yet to find any
solution. Same thing happens with avconv.


Am I missing something blatantly obvious here? Any help even a shove in the
right direction would be much appreciated.


More information about the ffmpeg-user mailing list