bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
10.78k stars 1.4k forks source link

Cannot play a 1080P60 RTMP stream #3193

Closed markseanryan closed 2 months ago

markseanryan commented 3 months ago

Which version are you using?

v1.5.1

Which operating system are you using?

Describe the issue

I have a GStreamer pipeline with audio and video publishing to MediaMTX.

When the pipeline framerate is set to 60Hz the video cannot be played from MediaMTX using ffplay.

At lower framerates (25,30,50Hz) the video can be played with ffplay.

Describe how to replicate the issue

  1. start the server - with sudo ./mediamtx
  2. publish by starting streaming with GStreamer
  3. try and read the video with the command ffplay -i rtmp://127.0.0.1/lll/abc
  4. if the GStreamer pipeline is set to 60Hz no video is displayed but at lower framerates the video is displayed.

Did you attach the server logs?

yes:

2024/04/05 07:15:14 INF MediaMTX v1.5.1
2024/04/05 07:15:14 INF configuration loaded from /home/msr/Downloads/test_mediamx/mediamtx.yml
2024/04/05 07:15:14 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2024/04/05 07:15:14 INF [RTMP] listener opened on :1935
2024/04/05 07:15:14 INF [HLS] listener opened on :8888
2024/04/05 07:15:14 INF [WebRTC] listener opened on :8889 (HTTP), :8189 (ICE/UDP)
2024/04/05 07:15:14 INF [SRT] listener opened on :8890 (UDP)
2024/04/05 07:15:32 INF [RTMP] [conn 10.0.0.141:33686] opened
2024/04/05 07:15:32 INF [RTMP] [conn 10.0.0.141:33686] is publishing to path 'lll/abc', 2 tracks (H264, MPEG-4 Audio)
2024/04/05 07:21:26 INF [RTMP] [conn 127.0.0.1:45984] opened
2024/04/05 07:21:26 INF [RTMP] [conn 127.0.0.1:45984] is reading from path 'lll/abc', 2 tracks (H264, MPEG-4 Audio)

Did you attach a network dump?

yes

markseanryan commented 3 months ago

The wireshark capture of the RTMP stream being published to MediaMTX is attached. wireshark_60.zip

markseanryan commented 3 months ago

Sometimes ffplay reports there is no video when trying to play the 60Hz stream:

[flv @ 0x7f8bcc000c80] Could not find codec parameters for stream 0 (Video: h264, none, 128 kb/s): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, flv, from 'rtmp://127.0.0.1/lll/abc':
Duration: N/A, start: 353.813000, bitrate: 128 kb/s
ream #0:0: Video: h264, none, 128 kb/s, 1k tbn
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
markseanryan commented 2 months ago

This was failing because gstreamer had a gop length of 60 by default. Changing the gop length to 30 solved the problem