mpv doesn't play an H.264 RTSP stream

Created on 7 Sep 2017  ·  3Comments  ·  Source: mpv-player/mpv

mpv version and platform

$ mpv --version
mpv 0.26.0 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
 built on Thu Jul 20 13:13:36 CEST 2017
ffmpeg library versions:
   libavutil       55.58.100
   libavcodec      57.89.100
   libavformat     57.71.100
   libswscale      4.6.100
   libavfilter     6.82.100
   libswresample   2.7.100
ffmpeg version: 3.3.3

Reproduction steps

When opening a video stream created by a cheap wifi IP camera:

$ mpv rtsp://user:[email protected]/onvif1
Playing: rtsp://user:[email protected]/onvif1
[ffmpeg/demuxer] rtsp: Nonmatching transport in server reply
[lavf] avformat_open_input() failed
Failed to recognize file format.

Expected behavior

Stream should play normally, as with any other media player.

Actual behavior

It doesn't

Log file

Relevant log:

[cplayer] Playing: rtsp://user:[email protected]/onvif1
[cplayer] Running hook: ytdl_hook/on_load
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Run command: hook-ack, flags=0, args=[on_load]
[ffmpeg] Opening rtsp://user:[email protected]/onvif1
[ffmpeg] Stream opened successfully.
[demux] Trying demuxers for level=request.
[lavf] Found 'rtsp' at score=100 size=0 (forced).
[ffmpeg/demuxer] rtsp: SDP:
[ffmpeg/demuxer] v=0
[ffmpeg/demuxer] o=- 1421069297525233 1 IN IP4 1.2.3.4
[ffmpeg/demuxer] s=H.264 Video, RtspServer_0.0.0.2
[ffmpeg/demuxer] t=0 0
[ffmpeg/demuxer] a=tool:RtspServer_0.0.0.2
[ffmpeg/demuxer] a=type:broadcast
[ffmpeg/demuxer] a=control:*
[ffmpeg/demuxer] a=range:npt=0-
[ffmpeg/demuxer] m=video 0 RTP/AVP 96
[ffmpeg/demuxer] c=IN IP4 0.0.0.0
[ffmpeg/demuxer] b=AS:500
[ffmpeg/demuxer] a=rtpmap:96 H264/90000
[ffmpeg/demuxer] a=fmtp:96 packetization-mode=1;profile-level-id=42001F;sprop-parameter-sets=Z0IAH5WoFAFuQA==,aM48gA==
[ffmpeg/demuxer] a=control:track1
[ffmpeg/demuxer] m=audio 0 RTP/AVP 8
[ffmpeg/demuxer] a=control:track2
[ffmpeg/demuxer] a=rtpmap:8 PCMA/8000
[ffmpeg/demuxer] 
[ffmpeg/demuxer] rtsp: Nonmatching transport in server reply
[lavf] avformat_open_input() failed
[cplayer] Opening failed or was aborted: rtsp://user:[email protected]/onvif1
[cplayer] finished playback, unrecognized file format (reason 4)
[cplayer] Failed to recognize file format.
core rtsp stream

Most helpful comment

I have a cheap IP camera with the exact same "onvif1" URL scheme as OP has. When I added "--rtsp-transport=lavf" or "--rtsp-transport=udp" to the command line, the stream worked. (See also #5540)

All 3 comments

Maybe try encapsulating the full rtsp address in double quotes? I just tried to stream my camera to MPV and found your issue while googling. Putting the full address in " " fixed the issue.

Looking at the full log maybe this isn't the case, my stream has /cam/realmonitor?channel=1&subtype=0 so the "&" was causing the issue. Is your camera set to stream on TCP?

I have a cheap IP camera with the exact same "onvif1" URL scheme as OP has. When I added "--rtsp-transport=lavf" or "--rtsp-transport=udp" to the command line, the stream worked. (See also #5540)

@NullNoname Thanks a lot, setting rtsp-transport=udp in one of my mpv profiles solved the pb.

G-d bless you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SPDurkee picture SPDurkee  ·  3Comments

beew picture beew  ·  3Comments

532910 picture 532910  ·  3Comments

laichiaheng picture laichiaheng  ·  3Comments

422658476 picture 422658476  ·  3Comments