RTMP stream on IE dies after ~1 second

匆匆过客 提交于 2019-12-11 12:21:20

问题


Follow-up from: RTMP stream plays sound for 1 second, then stops - no video at all

The behavior here is really strange.

My config:

jwplayer('canvas').setup({
    file : "stream.smil",
    width : 1024,
    height : 768,
    stagevideo : false,
    autostart : true
});

stream.smil:

<smil>
  <head>
    <meta base="rtmp://192.168.1.160:1340/live/" />
  </head>
  <body>
    <switch>
      <video src="large" width="1024" height="768" system-bitrate="2000000" />
      <video src="small" width="640" height="480" system-bitrate="800000" />
    </switch>
  </body>
</smil>

So, okay, turning off stagevideo (GPU rendering) helped with the white video, but the audio problem remains, though, I have some new information.

My RTMP server is nginx with rtmp module, listening on 1340 (as smil suggests).
I have a Mobotix IP Camera which output I use as an input for my ffmpeg, that then feeds the RTMP server:

ffmpeg -f mxg -i "http://admin:meinsm@192.168.1.161:80/control/faststream.jpg?stream=MxPEG&needlength" -f flv -ar 44100 -s 1024x768 "rtmp://localhost:1340/live/large"

Chrome, Firefox, Opera, Safari works as expected, IE though, that's a totally different miraculous world:

  1. Once I open the page, I can almost immediately hear audio, then it takes some time to load video, once it loads, it plays for about 1s, then the audio stops and video freezes.
  2. If I switch to a lower quality stream, same happens - I can almost immediately hear audio, takes time to load video, once loads - ~1s and dead.
  3. If I restart the ffmpeg feeder without pausing/closing the player/stream itself, then, after a short amount of time the player starts to play both, the audio and the video with no interruptions. If at some point I change streams again or reload the page - we're back to #1. I can then again restart ffmpeg feeder and the video will continue as if nothing had happened.

I feel that it might be an issue with the MxPEG live stream, because it uses it's own codec and has some differences from default codecs, one of them being (http://developer.mobotix.com/docs/params.html):

Instead of I-frames...

With the current MxPEG implementation, there is no way to tell the codec to include a full JPEG frame, say, every second or every 20 frames. Therefore, there's no I-Frame concept known from other codecs. But the way sketched above, jumping back one second and start decoding, may serve as a practical workaround.

There is extra information about the codec itself available here.

Though, even if there is such a difference, that doesn't explain why it's only IE that doesn't work (though, it has no problems if I restart the feed while the player is reading from RTMP).

I'm out of clues here, I have tried changing FLV codec to x264 with AAC - Chrome, Opera, Firefox, Safari works, IE doesn't (different problem though).

I also tried feeding ffmpeg a static video file as input (Blenders' Sintel video, mp4) using the same options for RTMP output - there I had consistent problems, the video stuttered on all browsers, but it did play.

But yes, somebody maybe have got a clue what is wrong here?


回答1:


I found out what's the problem: https://github.com/arut/nginx-rtmp-module/issues/340

Actually, documentation even says that it should be enabled by default: https://github.com/arut/nginx-rtmp-module/wiki/Directives#wait_video

Yes, apparently, if you're running nginx rtmp module for RTMP hosting, you need to set:

wait_video on;

In your RTMP applications' configuration block.



来源:https://stackoverflow.com/questions/23562566/rtmp-stream-on-ie-dies-after-1-second

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!