mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.23k stars 2.9k forks source link

Can't play RTP/H264 stream with TCP #4475

Closed WhidbeyFog closed 7 years ago

WhidbeyFog commented 7 years ago

mpv version and platform

mpv 0.25.0-80-g37f057197 (C) 2000-2017 mpv/MPlayer/mplayer2 projects 14:44:07.951 [cplayer] built on Sat May 20 09:29:55 UTC 2017 14:44:07.951 [cplayer] ffmpeg library versions: 14:44:07.952 [cplayer] libavutil 55.63.100 14:44:07.952 [cplayer] libavcodec 57.96.101 14:44:07.952 [cplayer] libavformat 57.72.101 14:44:07.952 [cplayer] libswscale 4.7.101 14:44:07.952 [cplayer] libavfilter 6.90.100 14:44:07.952 [cplayer] libswresample 2.8.100 14:44:07.953 [cplayer] ffmpeg version: N-44706-g42f1509121

Reproduction steps

On Windows, Run mpv with server that streams RTP over TCP.

Expected behavior

Mpv makes a tcp connection to server.

Actual behavior

Mpv listens on on udp.

Log file

https://drive.google.com/open?id=0B1ui2z3CBZ8RVnYxWU4zWnBySDg

Background: mpv is working with my application using udp transport. It does have a caching problem due to lack of circular buffer availability. https://github.com/mpv-player/mpv/issues/4232 (Despite that, It does work over my local network using untimed=yes)

Now I'm attempting to get mpv working over tcp because of the caching issue, and also because of the problems with udp working over the internet through firewalls and such.

In an attempt to make this work I modified the sdp file that my server provides to mpv. The modification was to change m=video 1234 RTP/AVP 96 to m=video 4688 TCP/RTP/AVP 96 per https://tools.ietf.org/id/draft-ietf-mmusic-sdp-tcpmedia-00.txt

In addition I added these lines to mpv.conf: demuxer-lavf-o=rtsp_transport=tcp demuxer-lavf-o=rtsp_flags=prefer_tcp

As the log shows, mpv behaves as if the transport protocol were udp. This is confirmed by observing that mpv was listening for video on udp port 1234. (SysInternals TcpView) And by the fact that my server never received a connection request on port 4688.

Hoping to get some guidance from the mpv team.

ghost commented 7 years ago

http is always TCP.

ghost commented 7 years ago

Actually, looking at this again this opens the sdp demuxer, which does something horrible by opening a few nested streams. Tracing a bit deeper into the code, it seems the option you mentioned are part of ff_rtsp_options, which is available only to the rtsp protocol, which isn't used here.

Also I see this ffmpeg log message in the log you posted (google drive is a fucking terrible file hoster, btw.):

14:44:08.155 [10280910] [ffmpeg] udp: 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
WhidbeyFog commented 7 years ago

Thanks for your inputs. I was able to reproduce the problem using ffplay, so will look there now.